aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2018-05-01 08:45:49 -0400
committerJason Merrill <jason@gcc.gnu.org>2018-05-01 08:45:49 -0400
commit38dff92114f41914541fded07bee54c48b817ee2 (patch)
tree46b4f311b012c8230c310b686837f4c444fdab95 /gcc/cp
parent879bdafad2621aae5d01ec58b45d8ea2f5ccf11e (diff)
downloadgcc-38dff92114f41914541fded07bee54c48b817ee2.zip
gcc-38dff92114f41914541fded07bee54c48b817ee2.tar.gz
gcc-38dff92114f41914541fded07bee54c48b817ee2.tar.bz2
PR c++/85580 - extern "C" and local variables
* name-lookup.c (check_extern_c_conflict): Ignore local decls. From-SVN: r259793
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog3
-rw-r--r--gcc/cp/name-lookup.c4
2 files changed, 7 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 65f556e..3453df8 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,8 @@
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.
* decl.c (grokdeclarator): Overhaul diagnostics for invalid use
of long/short/signed/unsigned.
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 2af2462..64c7b6f 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -2527,6 +2527,10 @@ check_extern_c_conflict (tree decl)
if (DECL_ARTIFICIAL (decl) || DECL_IN_SYSTEM_HEADER (decl))
return;
+ /* This only applies to decls at namespace scope. */
+ if (!DECL_NAMESPACE_SCOPE_P (decl))
+ return;
+
if (!extern_c_decls)
extern_c_decls = hash_table<named_decl_hash>::create_ggc (127);