| 1 |
// RUN: %clang_cc1 %s -std=c++11 -Wignored-base-class-qualifiers -verify |
| 2 |
// RUN: %clang_cc1 %s -std=c++11 -Wno-ignored-qualifiers -verify=good |
| 3 |
// good-no-diagnostics |
| 4 |
|
| 5 |
template <typename T> struct add_const { |
| 6 |
using type = const T; |
| 7 |
}; |
| 8 |
template <typename T> using add_const_t = typename add_const<T>::type; |
| 9 |
|
| 10 |
class A { }; |
| 11 |
|
| 12 |
typedef const A A_Const; |
| 13 |
class B : public A_Const { }; // expected-warning {{'const' qualifier on base class type 'A_Const' (aka 'const A') has no effect}} \ |
| 14 |
// expected-note {{base class 'A_Const' (aka 'const A') specified here}} |
| 15 |
|
| 16 |
typedef const volatile A A_Const_Volatile; |
| 17 |
class C : public A_Const_Volatile { }; // expected-warning {{'const volatile' qualifiers on base class type 'A_Const_Volatile' (aka 'const volatile A') have no effect}} \ |
| 18 |
// expected-note {{base class 'A_Const_Volatile' (aka 'const volatile A') specified here}} |
| 19 |
|
| 20 |
struct D { |
| 21 |
D(int); |
| 22 |
}; |
| 23 |
|
| 24 |
template <typename T> struct E : T { // expected-warning {{'const' qualifier on base class type 'const D' has no effect}} \ |
| 25 |
// expected-note {{base class 'const D' specified here}} |
| 26 |
using T::T; |
| 27 |
E(int &) : E(0) {} |
| 28 |
}; |
| 29 |
E<const D> e(1); // expected-note {{in instantiation of template class 'E<const D>' requested here}} |
| 30 |
|
| 31 |
template <typename T> |
| 32 |
struct G : add_const<T>::type { // expected-warning {{'const' qualifier on base class type 'add_const<D>::type' (aka 'const D') has no effect}} \ |
| 33 |
// expected-note {{base class 'add_const<D>::type' (aka 'const D') specified here}} |
| 34 |
using T::T; |
| 35 |
G(int &) : G(0) {} |
| 36 |
}; |
| 37 |
G<D> g(1); // expected-note {{in instantiation of template class 'G<D>' requested here}} |