xref: /aosp_15_r20/external/clang/test/SemaCXX/pr13394-crash-on-invalid.cpp (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
2*67e74705SXin Li // Don't crash (PR13394).
3*67e74705SXin Li 
4*67e74705SXin Li namespace stretch_v1 {
5*67e74705SXin Li   struct closure_t {
6*67e74705SXin Li     const stretch_v1::ops_t* d_methods; // expected-error {{no type named 'ops_t' in namespace 'stretch_v1'}}
7*67e74705SXin Li   };
8*67e74705SXin Li }
9*67e74705SXin Li namespace gatekeeper_v1 {
10*67e74705SXin Li   namespace gatekeeper_factory_v1 {
11*67e74705SXin Li     struct closure_t { // expected-note {{'closure_t' declared here}} expected-note {{'gatekeeper_factory_v1::closure_t' declared here}}
12*67e74705SXin Li       gatekeeper_v1::closure_t* create(); // expected-error {{no type named 'closure_t' in namespace 'gatekeeper_v1'; did you mean simply 'closure_t'?}}
13*67e74705SXin Li     };
14*67e74705SXin Li   }
15*67e74705SXin Li   // FIXME: Typo correction should remove the 'gatekeeper_v1::' name specifier
16*67e74705SXin Li   gatekeeper_v1::closure_t *x; // expected-error {{no type named 'closure_t' in namespace 'gatekeeper_v1'; did you mean 'gatekeeper_factory_v1::closure_t'}}
17*67e74705SXin Li }
18*67e74705SXin Li 
19*67e74705SXin Li namespace Foo {
20*67e74705SXin Li struct Base {
BarFoo::Base21*67e74705SXin Li   void Bar() {} // expected-note{{'Bar' declared here}}
22*67e74705SXin Li };
23*67e74705SXin Li }
24*67e74705SXin Li 
25*67e74705SXin Li struct Derived : public Foo::Base {
testDerived26*67e74705SXin Li   void test() {
27*67e74705SXin Li     Foo::Bar(); // expected-error{{no member named 'Bar' in namespace 'Foo'; did you mean simply 'Bar'?}}
28*67e74705SXin Li   }
29*67e74705SXin Li };
30