1 // RUN: %clang_cc1 -std=c++17 -fms-compatibility -fsyntax-only -verify=before,expected %s
2 // RUN: %clang_cc1 -std=c++17 -fms-compatibility -fdelayed-template-parsing -fsyntax-only -verify=before,expected %s
3 // RUN: %clang_cc1 -std=c++20 -fms-compatibility -fsyntax-only -verify=after,expected %s
4 // RUN: %clang_cc1 -std=c++20 -fms-compatibility -fdelayed-template-parsing -fsyntax-only -verify=after,expected %s
11 class Based
{}; // Trying to trick the typo detection
14 class Derived
: public Base
<T
> {
16 // after-error@+1 {{member initializer 'Base' does not name a non-static data member or base class}}
17 Derived() : Base() {} // before-warning {{unqualified base initializer of class templates is a Microsoft extension}}
19 int Baze
; // Trying to trick the typo detection
22 template <class T
> struct AggregateBase
{
27 struct AggregateDerived
: public AggregateBase
<T
> {
30 // after-error@+1 {{member initializer 'AggregateBase' does not name a non-static data member or base class}}
31 AggregateDerived(T j
) : AggregateBase
{4}, i
{j
} {} // before-warning {{unqualified base initializer of class templates is a Microsoft extension}}
33 return i
+ AggregateBase::i
; // expected-warning {{use of undeclared identifier 'AggregateBase'; unqualified lookup into dependent bases of class template 'AggregateDerived' is a Microsoft extension}}
37 template <class T
, typename U
> struct MultiTypesBase
{
40 template <class T
, class U
>
41 struct MultiTypesDerived
: public MultiTypesBase
<T
, U
> {
42 // after-error@+1 {{member initializer 'MultiTypesBase' does not name a non-static data member or base class}}
43 MultiTypesDerived() : MultiTypesBase
{} {} // before-warning {{unqualified base initializer of class templates is a Microsoft extension}}
46 template <int I
> struct IntegerBase
{
50 struct IntegerDerived
: public IntegerBase
<I
> {
51 // after-error@+1 {{member initializer 'IntegerBase' does not name a non-static data member or base class}}
52 IntegerDerived() : IntegerBase
{} {} // before-warning {{unqualified base initializer of class templates is a Microsoft extension}}
55 template <class T
> struct ConformingBase
{
60 struct ConformingDerived
: public ConformingBase
<T
> {
63 ConformingDerived(T j
) : ConformingBase
<T
>{4}, i
{j
} {}
65 return i
+ ConformingBase
<T
>::i
;
73 AggregateDerived
<int> AD
{2};
74 AD
.AggregateBase::i
= 3;
77 MultiTypesDerived
<int, double> MTD
;
81 ConformingDerived
<int> CD
{2};
87 template <typename Type
, int TSize
> class Vec
{}; // expected-note {{template is declared here}}
89 template <int TDim
> class Index
: public Vec
<int, TDim
> {
90 // after-error@+1 {{member initializer 'Vec' does not name a non-static data member or base class}}
91 Index() : Vec() {} // before-warning {{unqualified base initializer of class templates is a Microsoft extension}}
94 template class Index
<0>;
96 template <typename T
> class Array
: public Vec
<T
, 4> {
97 // after-error@+1 {{member initializer 'Vec' does not name a non-static data member or base class}}
98 Array() : Vec() {} // before-warning {{unqualified base initializer of class templates is a Microsoft extension}}
101 template class Array
<double>;
103 template <typename T
> class Wrong
: public Vec
<T
, 4> {
104 Wrong() : NonExistent() {} // expected-error {{member initializer 'NonExistent' does not name a non-static data member or base class}}
107 template class Wrong
<double>;
109 template <typename T
> class Wrong2
: public Vec
<T
, 4> {
110 Wrong2() : Vec
<T
>() {} // expected-error {{too few template arguments for class template 'Vec'}}
113 template class Wrong2
<double>;
115 template <typename T
> class Wrong3
: public Vec
<T
, 4> {
116 Wrong3() : Base() {} // expected-error {{member initializer 'Base' does not name a non-static data member or base class}}
119 template class Wrong3
<double>;