diff options
author | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-02-14 22:57:34 +0000 |
---|---|---|
committer | dmalcolm <dmalcolm@138bc75d-0d04-0410-961f-82ee72b054a4> | 2019-02-14 22:57:34 +0000 |
commit | 948b609a846b2b622eb8bcac8850054781683b52 (patch) | |
tree | 782e9e7bfad2023e9666df8ecf10c33ccb8abee2 /gcc/cp/name-lookup.c | |
parent | 34579eb1927ddd05ff626fd76829aef4162cfb4d (diff) |
Don't offer suggestions for compiler-generated variables (PR c++/85515)
gcc/cp/ChangeLog:
Backport of r259720 from trunk.
2018-04-27 David Malcolm <dmalcolm@redhat.com>
PR c++/85515
* name-lookup.c (consider_binding_level): Skip compiler-generated
variables.
* search.c (lookup_field_fuzzy_info::fuzzy_lookup_field): Flatten
nested if statements into a series of rejection tests. Reject
lambda-ignored entities as suggestions.
gcc/testsuite/ChangeLog:
Backport of r259720 from trunk.
2018-04-27 David Malcolm <dmalcolm@redhat.com>
PR c++/85515
* g++.dg/pr85515-1.C: New test.
* g++.dg/pr85515-2.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-8-branch@268908 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp/name-lookup.c')
-rw-r--r-- | gcc/cp/name-lookup.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 4ce632c8f081..86fa03b77906 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -5863,6 +5863,12 @@ consider_binding_level (tree name, best_match <tree, const char *> &bm, && DECL_ANTICIPATED (d)) continue; + /* Skip compiler-generated variables (e.g. __for_begin/__for_end + within range for). */ + if (TREE_CODE (d) == VAR_DECL + && DECL_ARTIFICIAL (d)) + continue; + tree suggestion = DECL_NAME (d); if (!suggestion) continue; |