+2020-02-13 Jason Merrill <jason@redhat.com>
+
+ PR c++/93643
+ PR c++/91476
+ * tree.c (decl_linkage): Always lk_none for locals.
+
2020-02-12 Jason Merrill <jason@redhat.com>
PR c++/92583
if (TREE_CODE (decl) == FIELD_DECL)
return lk_none;
+ /* Things in local scope do not have linkage. */
+ if (decl_function_context (decl))
+ return lk_none;
+
/* Things that are TREE_PUBLIC have external linkage. */
if (TREE_PUBLIC (decl))
return lk_external;
if (TREE_CODE (decl) == CONST_DECL)
return decl_linkage (TYPE_NAME (DECL_CONTEXT (decl)));
- /* Things in local scope do not have linkage, if they don't have
- TREE_PUBLIC set. */
- if (decl_function_context (decl))
- return lk_none;
-
/* Members of the anonymous namespace also have TREE_PUBLIC unset, but
are considered to have external linkage for language purposes, as do
template instantiations on targets without weak symbols. DECLs really
--- /dev/null
+// PR c++/93643
+
+void* callback(const char* name);
+
+extern "C" {
+
+ inline void f1()
+ {
+ static void (*f)();
+ f = (void(*)()) callback("f1");
+ f();
+ }
+
+ inline void f2()
+ {
+ static void (*f)();
+ f = (void(*)()) callback("f2");
+ f();
+ }
+
+} // extern "C"
+
+int main()
+{
+ f1();
+ f2();
+}