[PR c++/87155] Anonymous namespace and
https://gcc.gnu.org/ml/gcc-patches/2018-08/msg02031.html PR c++/87155 PR c++/84707 cp/ * name-lookup.c (name_lookup::search_namespace): Don't look at inlines when searching for NULL names. testsuite/ * g++.dg/cpp0x/pr87155.C: New. * g++.dg/cpp0x/inline-ns10.C: Adjust. From-SVN: r264016
This commit is contained in:
parent
5036f628c7
commit
7a4e1f7d63
@ -1,5 +1,10 @@
|
||||
2018-08-31 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
PR c++/87155
|
||||
PR c++/84707
|
||||
* name-lookup.c (name_lookup::search_namespace): Don't look at
|
||||
inlines when searching for NULL names.
|
||||
|
||||
* decl.c (decls_match): Remove SYSTEM_IMPLICIT_EXTERN_C matching
|
||||
of return types and parms.
|
||||
* parser.c (cp_parser_parameter_declaration_clause): Likewise,
|
||||
|
@ -558,11 +558,14 @@ name_lookup::search_namespace (tree scope)
|
||||
|
||||
/* Look in exactly namespace. */
|
||||
bool found = search_namespace_only (scope);
|
||||
|
||||
/* Recursively look in its inline children. */
|
||||
if (vec<tree, va_gc> *inlinees = DECL_NAMESPACE_INLINEES (scope))
|
||||
for (unsigned ix = inlinees->length (); ix--;)
|
||||
found |= search_namespace ((*inlinees)[ix]);
|
||||
|
||||
/* Don't look into inline children, if we're looking for an
|
||||
anonymous name -- it must be in the current scope, if anywhere. */
|
||||
if (name)
|
||||
/* Recursively look in its inline children. */
|
||||
if (vec<tree, va_gc> *inlinees = DECL_NAMESPACE_INLINEES (scope))
|
||||
for (unsigned ix = inlinees->length (); ix--;)
|
||||
found |= search_namespace ((*inlinees)[ix]);
|
||||
|
||||
if (found)
|
||||
mark_found (scope);
|
||||
|
@ -1,3 +1,10 @@
|
||||
2018-08-31 Nathan Sidwell <nathan@acm.org>
|
||||
|
||||
PR c++/87155
|
||||
PR c++/84707
|
||||
* g++.dg/cpp0x/pr87155.C: New.
|
||||
* g++.dg/cpp0x/inline-ns10.C: Adjust.
|
||||
|
||||
2018-08-31 Jakub Jelinek <jakub@redhat.com>
|
||||
|
||||
PR middle-end/87138
|
||||
|
@ -2,7 +2,10 @@
|
||||
// { dg-do compile { target c++11 } }
|
||||
|
||||
inline namespace {
|
||||
namespace {}
|
||||
namespace {} // not this one
|
||||
void a ();
|
||||
}
|
||||
|
||||
namespace {} // { dg-error "conflicts" }
|
||||
namespace {
|
||||
int a (); // { dg-error "ambiguating" "" }
|
||||
}
|
||||
|
14
gcc/testsuite/g++.dg/cpp0x/pr87155.C
Normal file
14
gcc/testsuite/g++.dg/cpp0x/pr87155.C
Normal file
@ -0,0 +1,14 @@
|
||||
// { dg-do compile { target c++11 } }
|
||||
// PR c++/87155 confused about which anon namespace
|
||||
|
||||
namespace {
|
||||
void a (); // this one
|
||||
}
|
||||
|
||||
inline namespace n2 {
|
||||
namespace {}
|
||||
}
|
||||
|
||||
namespace {
|
||||
int a (); // { dg-error "ambiguating" "" }
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user