brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · 34d549b Raw
62 lines · cpp
1// RUN: %clang_cc1 -verify %s -std=c++202 3// We avoid printing the name of an inline namespace unless it's necessary to4// uniquely identify the target.5namespace N {6  inline namespace A {7    inline namespace B {8      inline namespace C {9        int f, g, h, i, j;10        struct f; struct g; struct h; struct i; struct j;11      }12      struct g;13      struct j;14    }15    struct h;16  }17  struct i;18  struct j;19 20  template<int*> struct Q; // expected-note 5{{here}}21  Q<&A::B::C::f> q1; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::f>'}}22  Q<&A::B::C::g> q2; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::C::g>'}}23  Q<&A::B::C::h> q3; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::B::h>'}}24  Q<&A::B::C::i> q4; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::A::i>'}}25  Q<&A::B::C::j> q5; // expected-error {{implicit instantiation of undefined template 'N::Q<&N::C::j>'}}26 27  template<typename> struct R; // expected-note 5{{here}}28  R<struct A::B::C::f> r1; // expected-error {{implicit instantiation of undefined template 'N::R<N::f>'}}29  R<struct A::B::C::g> r2; // expected-error {{implicit instantiation of undefined template 'N::R<N::C::g>'}}30  R<struct A::B::C::h> r3; // expected-error {{implicit instantiation of undefined template 'N::R<N::B::h>'}}31  R<struct A::B::C::i> r4; // expected-error {{implicit instantiation of undefined template 'N::R<N::A::i>'}}32  R<struct A::B::C::j> r5; // expected-error {{implicit instantiation of undefined template 'N::R<N::C::j>'}}33 34  // Make the name N::C ambiguous.35  inline namespace A { int C; }36 37  template<int*> struct S; // expected-note 5{{here}}38  S<&A::B::C::f> s1; // expected-error {{implicit instantiation of undefined template 'N::S<&N::f>'}}39  S<&A::B::C::g> s2; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::C::g>'}}40  S<&A::B::C::h> s3; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::h>'}}41  S<&A::B::C::i> s4; // expected-error {{implicit instantiation of undefined template 'N::S<&N::A::i>'}}42  S<&A::B::C::j> s5; // expected-error {{implicit instantiation of undefined template 'N::S<&N::B::C::j>'}}43 44  template<typename> struct T; // expected-note 5{{here}}45  T<struct A::B::C::f> t1; // expected-error {{implicit instantiation of undefined template 'N::T<N::f>'}}46  T<struct A::B::C::g> t2; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::C::g>'}}47  T<struct A::B::C::h> t3; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::h>'}}48  T<struct A::B::C::i> t4; // expected-error {{implicit instantiation of undefined template 'N::T<N::A::i>'}}49  T<struct A::B::C::j> t5; // expected-error {{implicit instantiation of undefined template 'N::T<N::B::C::j>'}}50}51 52namespace dont_crash {53// A malformed lookup involving inline namespaces in a linkage specification54// would previous cause an assertion due to the way diagnostics are emitted.55extern "C++" inline namespace {56namespace a {57  a : b // expected-error {{unexpected ':' in nested name specifier; did you mean '::'?}} \58        // expected-error {{no type named 'b' in namespace 'dont_crash::a'}}59} // expected-error {{expected unqualified-id}}60} // inline namespace61} // dont_crash62