aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJakub Jelinek <jakub@redhat.com>2016-09-14 23:55:10 +0200
committerJakub Jelinek <jakub@gcc.gnu.org>2016-09-14 23:55:10 +0200
commit28ca05f00ab3fbf9a478457e68e02178597dd342 (patch)
tree9a80734f757b355337587250a198b1c47ac07094 /gcc/cp
parentf6c7d678f880b246e733b3aedec5f1220eb8afb4 (diff)
downloadgcc-28ca05f00ab3fbf9a478457e68e02178597dd342.zip
gcc-28ca05f00ab3fbf9a478457e68e02178597dd342.tar.gz
gcc-28ca05f00ab3fbf9a478457e68e02178597dd342.tar.bz2
re PR c++/77549 (ICE on invalid C++ code that references undeclared variable)
PR c++/77549 * name-lookup.c (consider_binding_level): Look through TREE_LIST and OVERLOAD. * g++.dg/lookup/pr77549.C: New test. From-SVN: r240148
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/name-lookup.c22
2 files changed, 22 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 001479c..26d730e 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2016-09-14 Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/77549
+ * name-lookup.c (consider_binding_level): Look through TREE_LIST
+ and OVERLOAD.
+
2016-09-14 Marek Polacek <polacek@redhat.com>
* typeck.c (cp_build_unary_op): Diagnose incrementing boolean
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 022ab6a..952d8b7 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -4707,19 +4707,29 @@ consider_binding_level (tree name, best_match <tree, tree> &bm,
for (tree t = lvl->names; t; t = TREE_CHAIN (t))
{
+ tree d = t;
+
+ /* OVERLOADs or decls from using declaration are wrapped into
+ TREE_LIST. */
+ if (TREE_CODE (d) == TREE_LIST)
+ {
+ d = TREE_VALUE (d);
+ d = OVL_CURRENT (d);
+ }
+
/* Don't use bindings from implicitly declared functions,
as they were likely misspellings themselves. */
- if (TREE_TYPE (t) == error_mark_node)
+ if (TREE_TYPE (d) == error_mark_node)
continue;
/* Skip anticipated decls of builtin functions. */
- if (TREE_CODE (t) == FUNCTION_DECL
- && DECL_BUILT_IN (t)
- && DECL_ANTICIPATED (t))
+ if (TREE_CODE (d) == FUNCTION_DECL
+ && DECL_BUILT_IN (d)
+ && DECL_ANTICIPATED (d))
continue;
- if (DECL_NAME (t))
- bm.consider (DECL_NAME (t));
+ if (DECL_NAME (d))
+ bm.consider (DECL_NAME (d));
}
}