xref: /llvm-project/clang/test/SemaCXX/base-class-ambiguity-check.cpp (revision 0f1c1be1968076d6f96f8a7bcc4a15cf195ecd97)
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
2 
3 template <typename T> class Foo {
4   struct Base : T {};
5 
6   // Test that this code no longer causes a crash in Sema.
7   struct Derived : Base, T {};
8 };
9 
10 
11 template <typename T> struct Foo2 {
12   struct Base1; // expected-note{{member is declared here}}
13   struct Base2; // expected-note{{member is declared here}}
14   // Should not crash on an incomplete-type and dependent base specifier.
15   struct Derived : Base1, Base2 {}; // expected-error {{implicit instantiation of undefined member 'Foo2<int>::Base1'}} \
16                                        expected-error {{implicit instantiation of undefined member 'Foo2<int>::Base2'}}
17 };
18 
19 Foo2<int>::Derived a; // expected-note{{in instantiation of member class}}
20