Douglas Gregor | 4b65441 | 2009-12-24 20:23:34 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | // PR5868 |
| 4 | struct T0 { |
| 5 | int x; |
| 6 | union { |
| 7 | void *m0; |
| 8 | }; |
| 9 | }; |
| 10 | template <typename T> |
Nathan Sidwell | 44b2174 | 2015-01-19 01:44:02 +0000 | [diff] [blame] | 11 | struct T1 : public T0, public T { //expected-warning{{direct base 'T0' is inaccessible due to ambiguity:\n struct T1<struct A> -> struct T0\n struct T1<struct A> -> struct A -> struct T0}} |
Douglas Gregor | 4b65441 | 2009-12-24 20:23:34 +0000 | [diff] [blame] | 12 | void f0() { |
| 13 | m0 = 0; // expected-error{{ambiguous conversion}} |
| 14 | } |
| 15 | }; |
| 16 | |
| 17 | struct A : public T0 { }; |
| 18 | |
Nathan Sidwell | 44b2174 | 2015-01-19 01:44:02 +0000 | [diff] [blame] | 19 | void f1(T1<A> *S) { S->f0(); } // expected-note{{instantiation of member function}} expected-note{{in instantiation of template class 'T1<A>' requested here}} |
Douglas Gregor | 25edf43 | 2010-11-05 23:22:45 +0000 | [diff] [blame] | 20 | |
| 21 | namespace rdar8635664 { |
| 22 | template<typename T> |
| 23 | struct X { |
| 24 | struct inner; |
| 25 | |
| 26 | struct inner { |
| 27 | union { |
| 28 | int x; |
| 29 | float y; |
| 30 | }; |
| 31 | |
| 32 | typedef T type; |
| 33 | }; |
| 34 | }; |
| 35 | |
| 36 | void test() { |
| 37 | X<int>::inner i; |
| 38 | i.x = 0; |
| 39 | } |
| 40 | } |