diff options
author | Nathan Sidwell <nathan@acm.org> | 2017-06-06 15:06:56 +0000 |
---|---|---|
committer | Nathan Sidwell <nathan@gcc.gnu.org> | 2017-06-06 15:06:56 +0000 |
commit | 25d446fd388959e5c87cfe621c17a9a2f78f90aa (patch) | |
tree | 8d81ad8835cae4cd80906db38e08b994d9cba439 /gcc | |
parent | 4ebcc903bf03705099cd4b50231dc8fe444d70b9 (diff) | |
download | gcc-25d446fd388959e5c87cfe621c17a9a2f78f90aa.zip gcc-25d446fd388959e5c87cfe621c17a9a2f78f90aa.tar.gz gcc-25d446fd388959e5c87cfe621c17a9a2f78f90aa.tar.bz2 |
re PR c++/80979 (ice in lookup_mark, at cp/tree.c:2298)
PR c++/80979
* name-lookup.c (adl_class_only): Don't add visible friends.
From-SVN: r248922
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/name-lookup.c | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lookup/pr80979.C | 26 |
3 files changed, 37 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index f9bd954..8200756 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-06-06 Nathan Sidwell <nathan@acm.org> + + PR c++/80979 + * name-lookup.c (adl_class_only): Don't add visible friends. + 2017-06-05 Volker Reichelt <v.reichelt@netcologne.de> * parser.c (cp_parser_base_specifier): Fix typos in error messages. diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c index 041d51c..169a1c9 100644 --- a/gcc/cp/name-lookup.c +++ b/gcc/cp/name-lookup.c @@ -801,6 +801,12 @@ name_lookup::adl_class_only (tree type) if (CP_DECL_CONTEXT (fn) != context) continue; + /* Only interested in anticipated friends. (Non-anticipated + ones will have been inserted during the namespace + adl.) */ + if (!DECL_ANTICIPATED (fn)) + continue; + /* Template specializations are never found by name lookup. (Templates themselves can be found, but not template specializations.) */ diff --git a/gcc/testsuite/g++.dg/lookup/pr80979.C b/gcc/testsuite/g++.dg/lookup/pr80979.C new file mode 100644 index 0000000..eb22f71 --- /dev/null +++ b/gcc/testsuite/g++.dg/lookup/pr80979.C @@ -0,0 +1,26 @@ +// pr C++/80979 ICE with late discovery of using directives during ADL +// of a friend declaration. + +namespace Tiny { + class Handsome {}; + void Dahl (Handsome &, Handsome &); + + namespace Jack { + class Vladof { + friend void Dahl (Vladof &, Vladof &); + }; + void Dahl (Vladof &, Vladof &); + } + + struct BDonk {}; + + namespace Tina { + void Dahl (BDonk &, Jack::Vladof &); + } + using Tina::Dahl; +} + +void BoomBoom (Tiny::BDonk &vault, Tiny::Jack::Vladof &hunter) +{ + Dahl (vault, hunter); +} |