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