Commit 38dff921 by Jason Merrill Committed by Jason Merrill

PR c++/85580 - extern "C" and local variables

	* name-lookup.c (check_extern_c_conflict): Ignore local decls.

From-SVN: r259793
parent 879bdafa
2018-04-30 Jason Merrill <jason@redhat.com> 2018-04-30 Jason Merrill <jason@redhat.com>
PR c++/85580 - extern "C" and local variables
* name-lookup.c (check_extern_c_conflict): Ignore local decls.
PR c++/84701 - unsigned typeof. PR c++/84701 - unsigned typeof.
* decl.c (grokdeclarator): Overhaul diagnostics for invalid use * decl.c (grokdeclarator): Overhaul diagnostics for invalid use
of long/short/signed/unsigned. of long/short/signed/unsigned.
......
...@@ -2527,6 +2527,10 @@ check_extern_c_conflict (tree decl) ...@@ -2527,6 +2527,10 @@ check_extern_c_conflict (tree decl)
if (DECL_ARTIFICIAL (decl) || DECL_IN_SYSTEM_HEADER (decl)) if (DECL_ARTIFICIAL (decl) || DECL_IN_SYSTEM_HEADER (decl))
return; return;
/* This only applies to decls at namespace scope. */
if (!DECL_NAMESPACE_SCOPE_P (decl))
return;
if (!extern_c_decls) if (!extern_c_decls)
extern_c_decls = hash_table<named_decl_hash>::create_ggc (127); extern_c_decls = hash_table<named_decl_hash>::create_ggc (127);
......
// PR c++/85580
extern "C"
{
void f1()
{
union some_type{
char a[2];
int b;
} variable;
}
void f2()
{
union some_type{
char a[2];
int b;
} variable;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment