[clang] NFC: new tests and some cleanups on existing ones (#142293)
This offloads some test changes from another PR in order to facilitate review. - Adds some new tests. - Cleans stray spaces and newlines on existing tests. - Regenerates some AST json dumps, as the generator now includes offsets.
This commit is contained in:
parent
2c855e629c
commit
fbb22ce1aa
@ -1,133 +1,133 @@
|
|||||||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -ast-dump -o - %s | FileCheck %s
|
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -ast-dump -o - %s | FileCheck %s
|
||||||
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -ast-dump -o - %s | FileCheck %s
|
// RUN: %clang_cc1 -triple dxil-pc-shadermodel6.0-compute -std=hlsl202x -ast-dump -o - %s | FileCheck %s
|
||||||
|
|
||||||
typedef float float2 __attribute__((ext_vector_type(2)));
|
typedef float float2 __attribute__((ext_vector_type(2)));
|
||||||
typedef float float3 __attribute__((ext_vector_type(3)));
|
typedef float float3 __attribute__((ext_vector_type(3)));
|
||||||
|
|
||||||
[numthreads(1,1,1)]
|
[numthreads(1,1,1)]
|
||||||
void entry() {
|
void entry() {
|
||||||
float2 Vec2 = float2(1.0, 2.0);
|
float2 Vec2 = float2(1.0, 2.0);
|
||||||
float3 Vec3 = float3(Vec2, 3.0);
|
float3 Vec3 = float3(Vec2, 3.0);
|
||||||
float3 Vec3b = float3(1.0, 2.0, 3.0);
|
float3 Vec3b = float3(1.0, 2.0, 3.0);
|
||||||
|
|
||||||
// For the float2 vector, we just expect a conversion from constructor
|
// For the float2 vector, we just expect a conversion from constructor
|
||||||
// parameters to an initialization list
|
// parameters to an initialization list
|
||||||
// CHECK-LABEL: VarDecl {{.*}} used Vec2 'float2':'vector<float, 2>' cinit
|
// CHECK-LABEL: VarDecl {{.*}} used Vec2 'float2':'vector<float, 2>' cinit
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'float2':'vector<float, 2>' functional cast to float2 <NoOp>
|
// CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'float2':'vector<float, 2>' functional cast to float2 <NoOp>
|
||||||
// CHECK-NEXT: InitListExpr {{.*}} 'float2':'vector<float, 2>'
|
// CHECK-NEXT: InitListExpr {{.*}} 'float2':'vector<float, 2>'
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
||||||
|
|
||||||
|
|
||||||
// For the float 3 things get fun...
|
// For the float 3 things get fun...
|
||||||
// Here we expect accesses to the vec2 to provide the first and second
|
// Here we expect accesses to the vec2 to provide the first and second
|
||||||
// components using ArraySubscriptExpr
|
// components using ArraySubscriptExpr
|
||||||
// CHECK-LABEL: VarDecl {{.*}} Vec3 'float3':'vector<float, 3>' cinit
|
// CHECK-LABEL: VarDecl {{.*}} Vec3 'float3':'vector<float, 3>' cinit
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
|
// CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
|
||||||
// CHECK-NEXT: InitListExpr {{.*}} 'float3':'vector<float, 3>'
|
// CHECK-NEXT: InitListExpr {{.*}} 'float3':'vector<float, 3>'
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
||||||
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'float' lvalue
|
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'float' lvalue
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue Var {{.*}} 'Vec2' 'float2':'vector<float, 2>'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue Var {{.*}} 'Vec2' 'float2':'vector<float, 2>'
|
||||||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0
|
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 0
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
||||||
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'float' lvalue
|
// CHECK-NEXT: ArraySubscriptExpr {{.*}} 'float' lvalue
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue Var {{.*}} 'Vec2' 'float2':'vector<float, 2>'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'float2':'vector<float, 2>' lvalue Var {{.*}} 'Vec2' 'float2':'vector<float, 2>'
|
||||||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
|
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 3.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 3.000000e+00
|
||||||
|
|
||||||
// CHECK: VarDecl {{.*}} 'float3':'vector<float, 3>' cinit
|
// CHECK: VarDecl {{.*}} 'float3':'vector<float, 3>' cinit
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
|
// CHECK-NEXT: CXXFunctionalCastExpr {{.*}} 'float3':'vector<float, 3>' functional cast to float3 <NoOp>
|
||||||
// CHECK-NEXT: InitListExpr {{.*}} 'float3':'vector<float, 3>'
|
// CHECK-NEXT: InitListExpr {{.*}} 'float3':'vector<float, 3>'
|
||||||
|
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 3.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 3.000000e+00
|
||||||
|
|
||||||
// The tests above verify pretty explictily that the Initialization lists are
|
// The tests above verify pretty explictily that the Initialization lists are
|
||||||
// being constructed as expected. The next tests are bit sparser for brevity.
|
// being constructed as expected. The next tests are bit sparser for brevity.
|
||||||
|
|
||||||
float f = 1.0f, g = 2.0f;
|
float f = 1.0f, g = 2.0f;
|
||||||
float2 foo0 = float2(f, g); // Non-literal
|
float2 foo0 = float2(f, g); // Non-literal
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo0 'float2'
|
// CHECK-LABEL: VarDecl {{.*}} foo0 'float2'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'float' lvalue Var {{.*}} 'f' 'float'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'float' lvalue Var {{.*}} 'f' 'float'
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'float' lvalue Var {{.*}} 'g' 'float'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'float' lvalue Var {{.*}} 'g' 'float'
|
||||||
|
|
||||||
int i = 1, j = 2;
|
int i = 1, j = 2;
|
||||||
float2 foo1 = float2(1, 2); // Integer literals
|
float2 foo1 = float2(1, 2); // Integer literals
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo1 'float2'
|
// CHECK-LABEL: VarDecl {{.*}} foo1 'float2'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
||||||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
|
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 1
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
||||||
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 2
|
// CHECK-NEXT: IntegerLiteral {{.*}} 'int' 2
|
||||||
|
|
||||||
float2 foo2 = float2(i, j); // Integer non-literal
|
float2 foo2 = float2(i, j); // Integer non-literal
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo2 'float2'
|
// CHECK-LABEL: VarDecl {{.*}} foo2 'float2'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'i' 'int'
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <IntegralToFloating>
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'j' 'int'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'int' lvalue Var {{.*}} 'j' 'int'
|
||||||
|
|
||||||
struct S { float f; } s;
|
struct S { float f; } s;
|
||||||
float2 foo4 = float2(s.f, s.f);
|
float2 foo4 = float2(s.f, s.f);
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo4 'float2'
|
// CHECK-LABEL: VarDecl {{.*}} foo4 'float2'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
||||||
// CHECK-NEXT: MemberExpr {{.*}} 'float' lvalue .f {{.*}}
|
// CHECK-NEXT: MemberExpr {{.*}} 'float' lvalue .f {{.*}}
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct S':'S' lvalue Var {{.*}} 's' 'struct S':'S'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct S':'S' lvalue Var {{.*}} 's' 'struct S':'S'
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <LValueToRValue>
|
||||||
// CHECK-NEXT: MemberExpr {{.*}} 'float' lvalue .f {{.*}}
|
// CHECK-NEXT: MemberExpr {{.*}} 'float' lvalue .f {{.*}}
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct S':'S' lvalue Var {{.*}} 's' 'struct S':'S'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct S':'S' lvalue Var {{.*}} 's' 'struct S':'S'
|
||||||
|
|
||||||
struct T {
|
struct T {
|
||||||
operator float() const { return 1.0f; }
|
operator float() const { return 1.0f; }
|
||||||
} t;
|
} t;
|
||||||
float2 foo5 = float2(t, t); // user-defined cast operator
|
float2 foo5 = float2(t, t); // user-defined cast operator
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo5 'float2'
|
// CHECK-LABEL: VarDecl {{.*}} foo5 'float2'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <UserDefinedConversion>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <UserDefinedConversion>
|
||||||
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'float'
|
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'float'
|
||||||
// CHECK-NEXT: MemberExpr {{.*}} '<bound member function type>' .operator float {{.*}}
|
// CHECK-NEXT: MemberExpr {{.*}} '<bound member function type>' .operator float {{.*}}
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'const T' lvalue <NoOp>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'const T' lvalue <NoOp>
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct T':'T' lvalue Var {{.*}} 't' 'struct T':'T'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct T':'T' lvalue Var {{.*}} 't' 'struct T':'T'
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <UserDefinedConversion>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'float' <UserDefinedConversion>
|
||||||
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'float'
|
// CHECK-NEXT: CXXMemberCallExpr {{.*}} 'float'
|
||||||
// CHECK-NEXT: MemberExpr {{.*}} '<bound member function type>' .operator float {{.*}}
|
// CHECK-NEXT: MemberExpr {{.*}} '<bound member function type>' .operator float {{.*}}
|
||||||
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'const T' lvalue <NoOp>
|
// CHECK-NEXT: ImplicitCastExpr {{.*}} 'const T' lvalue <NoOp>
|
||||||
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct T':'T' lvalue Var {{.*}} 't' 'struct T':'T'
|
// CHECK-NEXT: DeclRefExpr {{.*}} 'struct T':'T' lvalue Var {{.*}} 't' 'struct T':'T'
|
||||||
|
|
||||||
typedef float2 second_level_of_typedefs;
|
typedef float2 second_level_of_typedefs;
|
||||||
second_level_of_typedefs foo6 = float2(1.0f, 2.0f);
|
second_level_of_typedefs foo6 = float2(1.0f, 2.0f);
|
||||||
|
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo6 'second_level_of_typedefs'
|
// CHECK-LABEL: VarDecl {{.*}} foo6 'second_level_of_typedefs'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
||||||
|
|
||||||
float2 foo7 = second_level_of_typedefs(1.0f, 2.0f);
|
float2 foo7 = second_level_of_typedefs(1.0f, 2.0f);
|
||||||
|
|
||||||
// CHECK-LABEL: VarDecl {{.*}} foo7 'float2'
|
// CHECK-LABEL: VarDecl {{.*}} foo7 'float2'
|
||||||
// CHECK-NEXT: CXXFunctionalCastExpr
|
// CHECK-NEXT: CXXFunctionalCastExpr
|
||||||
// CHECK-NEXT: InitListExpr
|
// CHECK-NEXT: InitListExpr
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 1.000000e+00
|
||||||
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
// CHECK-NEXT: FloatingLiteral {{.*}} 'float' 2.000000e+00
|
||||||
|
|
||||||
}
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -18,7 +18,7 @@ struct X { int i, j, k; };
|
|||||||
struct X { int i, j, k = 42; };
|
struct X { int i, j, k = 42; };
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
void f1(const X(&)[N]); // #cwg2149-f1
|
void f1(const X(&)[N]); // #cwg2149-f1
|
||||||
|
|
||||||
template<int N>
|
template<int N>
|
||||||
@ -30,7 +30,7 @@ void f() {
|
|||||||
X b[2] = { { 1, 2, 3 }, { 4, 5, 6 } };
|
X b[2] = { { 1, 2, 3 }, { 4, 5, 6 } };
|
||||||
X c[][2] = { 1, 2, 3, 4, 5, 6 };
|
X c[][2] = { 1, 2, 3, 4, 5, 6 };
|
||||||
static_assert(sizeof(c) / sizeof(X[2]) == 1, "");
|
static_assert(sizeof(c) / sizeof(X[2]) == 1, "");
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
#if __cplusplus >= 201103L
|
||||||
constexpr X ca[] = { 1, 2, 3, 4, 5, 6 };
|
constexpr X ca[] = { 1, 2, 3, 4, 5, 6 };
|
||||||
constexpr X cb[2] = { { 1, 2, 3 }, { 4, 5, 6 } };
|
constexpr X cb[2] = { { 1, 2, 3 }, { 4, 5, 6 } };
|
||||||
|
@ -48,9 +48,9 @@ namespace pointer_to_object_parameters {
|
|||||||
X(int, int);
|
X(int, int);
|
||||||
operator int() const;
|
operator int() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<X const *Ptr> struct A2; // expected-note 0-1{{template parameter is declared here}}
|
template<X const *Ptr> struct A2; // expected-note 0-1{{template parameter is declared here}}
|
||||||
|
|
||||||
X *X_ptr; // expected-note 0-1{{declared here}}
|
X *X_ptr; // expected-note 0-1{{declared here}}
|
||||||
X an_X;
|
X an_X;
|
||||||
X array_of_Xs[10];
|
X array_of_Xs[10];
|
||||||
@ -131,16 +131,16 @@ namespace reference_parameters {
|
|||||||
S3<vi> s3v;
|
S3<vi> s3v;
|
||||||
S3<cvi> s3cv;
|
S3<cvi> s3cv;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace PR6250 {
|
namespace PR6250 {
|
||||||
template <typename T, const T &ref> void inc() {
|
template <typename T, const T &ref> void inc() {
|
||||||
ref++; // expected-error{{read-only variable is not assignable}}
|
ref++; // expected-error{{read-only variable is not assignable}}
|
||||||
}
|
}
|
||||||
|
|
||||||
template<typename T, const T &ref> void bind() {
|
template<typename T, const T &ref> void bind() {
|
||||||
T &ref2 = ref; // expected-error{{drops 'const' qualifier}}
|
T &ref2 = ref; // expected-error{{drops 'const' qualifier}}
|
||||||
}
|
}
|
||||||
|
|
||||||
int counter;
|
int counter;
|
||||||
void test() {
|
void test() {
|
||||||
inc<int, counter>(); // expected-note{{instantiation of}}
|
inc<int, counter>(); // expected-note{{instantiation of}}
|
||||||
@ -213,7 +213,7 @@ namespace reference_to_function {
|
|||||||
// (13.4).
|
// (13.4).
|
||||||
namespace pointer_to_member_function {
|
namespace pointer_to_member_function {
|
||||||
struct X { };
|
struct X { };
|
||||||
struct Y : X {
|
struct Y : X {
|
||||||
int f(int);
|
int f(int);
|
||||||
int g(int);
|
int g(int);
|
||||||
int g(float);
|
int g(float);
|
||||||
|
@ -66,7 +66,7 @@ void test_f1() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace std_example {
|
namespace std_example {
|
||||||
template <class T> int f(T&&);
|
template <class T> int f(T&&);
|
||||||
template <class T> int g(const T&&); // expected-note{{candidate function [with T = int] not viable: expects an rvalue for 1st argument}}
|
template <class T> int g(const T&&); // expected-note{{candidate function [with T = int] not viable: expects an rvalue for 1st argument}}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
@ -100,7 +100,7 @@ namespace test0 {
|
|||||||
struct A {};
|
struct A {};
|
||||||
struct B : virtual A { int x; };
|
struct B : virtual A { int x; };
|
||||||
struct C : B {};
|
struct C : B {};
|
||||||
|
|
||||||
void test(C &in) {
|
void test(C &in) {
|
||||||
C tmp = in;
|
C tmp = in;
|
||||||
}
|
}
|
||||||
@ -117,7 +117,7 @@ namespace test1 {
|
|||||||
|
|
||||||
// Ensure that we
|
// Ensure that we
|
||||||
// a) emit the ABI-required but useless complete object and deleting destructor
|
// a) emit the ABI-required but useless complete object and deleting destructor
|
||||||
// symbols for an abstract class, and
|
// symbols for an abstract class, and
|
||||||
// b) do *not* emit references to virtual base destructors for an abstract class
|
// b) do *not* emit references to virtual base destructors for an abstract class
|
||||||
//
|
//
|
||||||
// Our approach to this is to give these functions a body that simply traps.
|
// Our approach to this is to give these functions a body that simply traps.
|
||||||
@ -168,3 +168,29 @@ namespace abstract {
|
|||||||
// CHECK-NOT: @_ZN8abstract1BD0Ev(
|
// CHECK-NOT: @_ZN8abstract1BD0Ev(
|
||||||
B::~B() {}
|
B::~B() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace redecl {
|
||||||
|
struct A {
|
||||||
|
A();
|
||||||
|
};
|
||||||
|
class A;
|
||||||
|
|
||||||
|
// CHECK-LABEL: define{{.*}} void @_ZN6redecl1AC2Ev(
|
||||||
|
// CHECK: define{{.*}} void @_ZN6redecl1AC1Ev(
|
||||||
|
// CHECK: call {{.*}} @_ZN6redecl1AC2Ev(
|
||||||
|
A::A() {}
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace fwdecl {
|
||||||
|
struct A;
|
||||||
|
struct A {
|
||||||
|
int v;
|
||||||
|
};
|
||||||
|
struct B : A {
|
||||||
|
B() = default;
|
||||||
|
B(int);
|
||||||
|
};
|
||||||
|
struct C : B {};
|
||||||
|
|
||||||
|
void f() { C{}; }
|
||||||
|
}
|
||||||
|
@ -45,6 +45,8 @@
|
|||||||
// RUN: FileCheck --check-prefix=CHECK-44 %s < %t
|
// RUN: FileCheck --check-prefix=CHECK-44 %s < %t
|
||||||
// RUN: FileCheck --check-prefix=CHECK-45 %s < %t
|
// RUN: FileCheck --check-prefix=CHECK-45 %s < %t
|
||||||
// RUN: FileCheck --check-prefix=CHECK-46 %s < %t
|
// RUN: FileCheck --check-prefix=CHECK-46 %s < %t
|
||||||
|
// RUN: FileCheck --check-prefix=CHECK-47 %s < %t
|
||||||
|
// RUN: FileCheck --check-prefix=CHECK-48 %s < %t
|
||||||
|
|
||||||
// For now, just verify this doesn't crash.
|
// For now, just verify this doesn't crash.
|
||||||
namespace test0 {
|
namespace test0 {
|
||||||
@ -98,7 +100,7 @@ namespace Test2 {
|
|||||||
struct A {
|
struct A {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
virtual void f() const;
|
virtual void f() const;
|
||||||
|
|
||||||
virtual A* g(int a);
|
virtual A* g(int a);
|
||||||
virtual ~A();
|
virtual ~A();
|
||||||
virtual void h();
|
virtual void h();
|
||||||
@ -148,7 +150,7 @@ namespace Test3 {
|
|||||||
struct A {
|
struct A {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
void A::f() { }
|
void A::f() { }
|
||||||
|
|
||||||
// CHECK-5: Vtable for 'Test3::B' (4 entries).
|
// CHECK-5: Vtable for 'Test3::B' (4 entries).
|
||||||
// CHECK-5-NEXT: 0 | offset_to_top (0)
|
// CHECK-5-NEXT: 0 | offset_to_top (0)
|
||||||
@ -205,7 +207,7 @@ struct D : B {
|
|||||||
virtual void h();
|
virtual void h();
|
||||||
};
|
};
|
||||||
|
|
||||||
void D::f() { }
|
void D::f() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Test4 {
|
namespace Test4 {
|
||||||
@ -241,7 +243,7 @@ struct V1 { int v1; };
|
|||||||
struct V2 : virtual V1 { int v1; };
|
struct V2 : virtual V1 { int v1; };
|
||||||
|
|
||||||
struct C {
|
struct C {
|
||||||
virtual V1 *f();
|
virtual V1 *f();
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK-9: Vtable for 'Test4::D' (4 entries).
|
// CHECK-9: Vtable for 'Test4::D' (4 entries).
|
||||||
@ -341,7 +343,7 @@ struct B2 : A {
|
|||||||
struct C : B1, B2 {
|
struct C : B1, B2 {
|
||||||
virtual void h();
|
virtual void h();
|
||||||
};
|
};
|
||||||
void C::h() { }
|
void C::h() { }
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace Test6 {
|
namespace Test6 {
|
||||||
@ -594,7 +596,7 @@ struct B : virtual A {
|
|||||||
|
|
||||||
virtual void a();
|
virtual void a();
|
||||||
};
|
};
|
||||||
void B::f() { }
|
void B::f() { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,8 +635,8 @@ namespace Test14 {
|
|||||||
|
|
||||||
// Verify that we handle A being a non-virtual base of B, which is a virtual base.
|
// Verify that we handle A being a non-virtual base of B, which is a virtual base.
|
||||||
|
|
||||||
struct A {
|
struct A {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct B : A { };
|
struct B : A { };
|
||||||
@ -688,10 +690,10 @@ struct C : virtual B { };
|
|||||||
//
|
//
|
||||||
// CHECK-22: VTable indices for 'Test15::D' (1 entries).
|
// CHECK-22: VTable indices for 'Test15::D' (1 entries).
|
||||||
// CHECK-22-NEXT: 1 | void Test15::D::f()
|
// CHECK-22-NEXT: 1 | void Test15::D::f()
|
||||||
struct D : A, virtual B, virtual C {
|
struct D : A, virtual B, virtual C {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
void D::f() { }
|
void D::f() { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -736,7 +738,7 @@ struct C : A, B { virtual ~C(); };
|
|||||||
struct D : virtual C {
|
struct D : virtual C {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
void D::f() { }
|
void D::f() { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -772,7 +774,7 @@ struct D : virtual B, virtual C { virtual void f(); };
|
|||||||
// CHECK-24: VTable indices for 'Test17::E' (1 entries).
|
// CHECK-24: VTable indices for 'Test17::E' (1 entries).
|
||||||
// CHECK-24-NEXT: 0 | void Test17::E::f()
|
// CHECK-24-NEXT: 0 | void Test17::E::f()
|
||||||
class E : virtual D {
|
class E : virtual D {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
void E::f() {}
|
void E::f() {}
|
||||||
|
|
||||||
@ -890,7 +892,7 @@ struct C : A, B {
|
|||||||
// CHECK-25-NEXT: 11 | void Test18::B::f()
|
// CHECK-25-NEXT: 11 | void Test18::B::f()
|
||||||
// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
|
// CHECK-25-NEXT: [this adjustment: 0 non-virtual, -24 vcall offset offset]
|
||||||
// CHECK-25-NEXT: 12 | void Test18::A::g()
|
// CHECK-25-NEXT: 12 | void Test18::A::g()
|
||||||
struct D : virtual B, virtual C, virtual A
|
struct D : virtual B, virtual C, virtual A
|
||||||
{
|
{
|
||||||
virtual void f();
|
virtual void f();
|
||||||
virtual void h();
|
virtual void h();
|
||||||
@ -990,7 +992,7 @@ void C::h() { }
|
|||||||
namespace Test21 {
|
namespace Test21 {
|
||||||
|
|
||||||
// Test that we get vbase offsets right in secondary vtables.
|
// Test that we get vbase offsets right in secondary vtables.
|
||||||
struct A {
|
struct A {
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1045,10 +1047,10 @@ namespace Test22 {
|
|||||||
// Very simple construction vtable test.
|
// Very simple construction vtable test.
|
||||||
struct V1 {
|
struct V1 {
|
||||||
int v1;
|
int v1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct V2 : virtual V1 {
|
struct V2 : virtual V1 {
|
||||||
int v2;
|
int v2;
|
||||||
};
|
};
|
||||||
|
|
||||||
// CHECK-29: Vtable for 'Test22::C' (8 entries).
|
// CHECK-29: Vtable for 'Test22::C' (8 entries).
|
||||||
@ -1072,10 +1074,10 @@ struct V2 : virtual V1 {
|
|||||||
// CHECK-29-NEXT: 2 | Test22::V2 RTTI
|
// CHECK-29-NEXT: 2 | Test22::V2 RTTI
|
||||||
|
|
||||||
struct C : virtual V1, virtual V2 {
|
struct C : virtual V1, virtual V2 {
|
||||||
int c;
|
int c;
|
||||||
virtual void f();
|
virtual void f();
|
||||||
};
|
};
|
||||||
void C::f() { }
|
void C::f() { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1127,7 +1129,7 @@ struct D : virtual A, virtual B, C {
|
|||||||
|
|
||||||
void f();
|
void f();
|
||||||
};
|
};
|
||||||
void D::f() { }
|
void D::f() { }
|
||||||
D d;
|
D d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1190,7 +1192,7 @@ void D::f() { }
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace Test25 {
|
namespace Test25 {
|
||||||
|
|
||||||
// This mainly tests that we don't assert on this class hierarchy.
|
// This mainly tests that we don't assert on this class hierarchy.
|
||||||
|
|
||||||
struct V {
|
struct V {
|
||||||
@ -1302,7 +1304,7 @@ struct C : virtual A {
|
|||||||
class D : virtual B, virtual C {
|
class D : virtual B, virtual C {
|
||||||
virtual void d();
|
virtual void d();
|
||||||
};
|
};
|
||||||
void D::d() { }
|
void D::d() { }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1577,7 +1579,7 @@ struct C : virtual A, virtual B {
|
|||||||
|
|
||||||
struct D : virtual C { };
|
struct D : virtual C { };
|
||||||
|
|
||||||
struct E : A, D {
|
struct E : A, D {
|
||||||
virtual void e();
|
virtual void e();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1822,7 +1824,7 @@ namespace Test37 {
|
|||||||
|
|
||||||
// Test that we give C::f the right vtable index. (PR9660).
|
// Test that we give C::f the right vtable index. (PR9660).
|
||||||
struct A {
|
struct A {
|
||||||
virtual A* f() = 0;
|
virtual A* f() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct B : virtual A {
|
struct B : virtual A {
|
||||||
@ -1925,3 +1927,80 @@ namespace Test40 {
|
|||||||
|
|
||||||
D d;
|
D d;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace Test41 {
|
||||||
|
struct A {
|
||||||
|
virtual ~A();
|
||||||
|
};
|
||||||
|
struct B;
|
||||||
|
struct B : A {};
|
||||||
|
// CHECK-47-LABEL: Vtable for 'Test41::C' (4 entries).
|
||||||
|
// CHECK-47-NEXT: 0 | offset_to_top (0)
|
||||||
|
// CHECK-47-NEXT: 1 | Test41::C RTTI
|
||||||
|
// CHECK-47-NEXT: -- (Test41::A, 0) vtable address --
|
||||||
|
// CHECK-47-NEXT: -- (Test41::B, 0) vtable address --
|
||||||
|
// CHECK-47-NEXT: -- (Test41::C, 0) vtable address --
|
||||||
|
// CHECK-47-NEXT: 2 | Test41::C::~C() [complete]
|
||||||
|
// CHECK-47-NEXT: 3 | Test41::C::~C() [deleting]
|
||||||
|
|
||||||
|
// CHECK-47-LABEL: VTable indices for 'Test41::C' (2 entries).
|
||||||
|
// CHECK-47-NEXT: 0 | Test41::C::~C() [complete]
|
||||||
|
// CHECK-47-NEXT: 1 | Test41::C::~C() [deleting]
|
||||||
|
struct C : B {};
|
||||||
|
C c;
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Test42 {
|
||||||
|
// CHECK-48-LABEL: Vtable for 'Test42::C' (3 entries).
|
||||||
|
// CHECK-48-NEXT: 0 | offset_to_top (0)
|
||||||
|
// CHECK-48-NEXT: 1 | Test42::C RTTI
|
||||||
|
// CHECK-48-NEXT: -- (Test42::A, 0) vtable address --
|
||||||
|
// CHECK-48-NEXT: -- (Test42::B, 0) vtable address --
|
||||||
|
// CHECK-48-NEXT: -- (Test42::C, 0) vtable address --
|
||||||
|
// CHECK-48-NEXT: 2 | void Test42::A::f()
|
||||||
|
|
||||||
|
// CHECK-48-LABEL: Vtable for 'Test42::B' (3 entries).
|
||||||
|
// CHECK-48-NEXT: 0 | offset_to_top (0)
|
||||||
|
// CHECK-48-NEXT: 1 | Test42::B RTTI
|
||||||
|
// CHECK-48-NEXT: -- (Test42::A, 0) vtable address --
|
||||||
|
// CHECK-48-NEXT: -- (Test42::B, 0) vtable address --
|
||||||
|
// CHECK-48-NEXT: 2 | void Test42::A::f()
|
||||||
|
|
||||||
|
// CHECK-48-LABEL: Vtable for 'Test42::A' (3 entries).
|
||||||
|
// CHECK-48-NEXT: 0 | offset_to_top (0)
|
||||||
|
// CHECK-48-NEXT: 1 | Test42::A RTTI
|
||||||
|
// CHECK-48-NEXT: -- (Test42::A, 0) vtable address --
|
||||||
|
// CHECK-48-NEXT: 2 | void Test42::A::f()
|
||||||
|
// CHECK-48-LABEL: VTable indices for 'Test42::A' (1 entries).
|
||||||
|
// CHECK-48-NEXT: 0 | void Test42::A::f()
|
||||||
|
struct A {
|
||||||
|
virtual void f();
|
||||||
|
};
|
||||||
|
struct B;
|
||||||
|
struct B : A {};
|
||||||
|
struct C : B {};
|
||||||
|
void test() { C c; }
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace Test43 {
|
||||||
|
struct A {
|
||||||
|
virtual ~A();
|
||||||
|
};
|
||||||
|
template <class T> struct B : T {};
|
||||||
|
struct C;
|
||||||
|
struct C : A {};
|
||||||
|
// CHECK-49-LABEL: Vtable for 'Test43::D' (4 entries).
|
||||||
|
// CHECK-49-NEXT: 0 | offset_to_top (0)
|
||||||
|
// CHECK-49-NEXT: 1 | Test43::D RTTI
|
||||||
|
// CHECK-49-NEXT: -- (Test43::A, 0) vtable address --
|
||||||
|
// CHECK-49-NEXT: -- (Test43::B, 0) vtable address --
|
||||||
|
// CHECK-49-NEXT: -- (Test43::C, 0) vtable address --
|
||||||
|
// CHECK-49-NEXT: -- (Test43::D, 0) vtable address --
|
||||||
|
// CHECK-49-NEXT: 2 | Test43::D::~D() [complete]
|
||||||
|
// CHECK-49-NEXT: 3 | Test43::D::~D() [deleting]
|
||||||
|
// CHECK-49-LABEL: VTable indices for 'D' (2 entries).
|
||||||
|
// CHECK-49-NEXT: 0 | Test43::D::~D() [complete]
|
||||||
|
// CHECK-49-NEXT: 1 | Test43::D::~D() [deleting]
|
||||||
|
struct D : B<C> {};
|
||||||
|
D d;
|
||||||
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacos-version-min=10.6 -fblocks -x objective-c %s
|
// RUN: c-index-test -write-pch %t.ast -arch x86_64 -mmacos-version-min=10.6 -fblocks -x objective-c %s
|
||||||
// RUN: c-index-test -test-load-tu %t.ast all > %t 2>&1 && FileCheck --input-file=%t %s
|
// RUN: c-index-test -test-load-tu %t.ast all > %t 2>&1 && FileCheck --input-file=%t %s
|
||||||
// REQUIRES: x86-registered-target
|
// REQUIRES: x86-registered-target
|
||||||
@interface Foo
|
@interface Foo
|
||||||
{
|
{
|
||||||
__attribute__((iboutlet)) id myoutlet;
|
__attribute__((iboutlet)) id myoutlet;
|
||||||
}
|
}
|
||||||
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@interface Bar : Foo
|
@interface Bar : Foo
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
11
clang/test/Parser/cxx-nested-name.cpp
Normal file
11
clang/test/Parser/cxx-nested-name.cpp
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
|
// expected-no-diagnostics
|
||||||
|
|
||||||
|
namespace binary_operator {
|
||||||
|
namespace N {
|
||||||
|
template <class> struct A {
|
||||||
|
static const int y = 0;
|
||||||
|
};
|
||||||
|
} // namespace N
|
||||||
|
void f(int x) { (void)(x < N::A<int>::y); }
|
||||||
|
} // namespace binary_operator
|
@ -18,3 +18,14 @@ namespace PR40329 {
|
|||||||
int k1 = B::e ->* B();
|
int k1 = B::e ->* B();
|
||||||
int k2 = B() ->* B::e;
|
int k2 = B() ->* B::e;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ForwardDecl {
|
||||||
|
struct A {
|
||||||
|
friend class B;
|
||||||
|
};
|
||||||
|
struct B {
|
||||||
|
enum E { X };
|
||||||
|
friend E operator|(E, E);
|
||||||
|
void g() { operator|(X, X); }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
// RUN: %clang_cc1 -fsyntax-only -verify=expected,cxx98 -std=c++98 %s
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++2a %s
|
||||||
|
|
||||||
@ -206,3 +206,18 @@ A GetA() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace ForwardDeclaredMember {
|
||||||
|
struct A;
|
||||||
|
struct A {
|
||||||
|
int x = 0;
|
||||||
|
// cxx98-warning@-1 {{default member initializer for non-static data member is a C++11 extension}}
|
||||||
|
// cxx98-note@-2 {{because field 'x' has an initializer}}
|
||||||
|
};
|
||||||
|
struct B {
|
||||||
|
struct {
|
||||||
|
A y;
|
||||||
|
// cxx98-error@-1 {{anonymous struct member 'y' has a non-trivial default constructor}}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -2,11 +2,11 @@
|
|||||||
|
|
||||||
class S {
|
class S {
|
||||||
public:
|
public:
|
||||||
S ();
|
S ();
|
||||||
};
|
};
|
||||||
|
|
||||||
struct D : S {
|
struct D : S {
|
||||||
D() :
|
D() :
|
||||||
b1(0), // expected-note {{previous initialization is here}}
|
b1(0), // expected-note {{previous initialization is here}}
|
||||||
b2(1),
|
b2(1),
|
||||||
b1(0), // expected-error {{multiple initializations given for non-static member 'b1'}}
|
b1(0), // expected-error {{multiple initializations given for non-static member 'b1'}}
|
||||||
@ -20,7 +20,7 @@ struct D : S {
|
|||||||
struct A {
|
struct A {
|
||||||
struct {
|
struct {
|
||||||
int a;
|
int a;
|
||||||
int b;
|
int b;
|
||||||
};
|
};
|
||||||
A();
|
A();
|
||||||
};
|
};
|
||||||
@ -31,7 +31,7 @@ namespace Test1 {
|
|||||||
template<typename T> struct A {};
|
template<typename T> struct A {};
|
||||||
template<typename T> struct B : A<T> {
|
template<typename T> struct B : A<T> {
|
||||||
|
|
||||||
B() : A<T>(), // expected-note {{previous initialization is here}}
|
B() : A<T>(), // expected-note {{previous initialization is here}}
|
||||||
A<T>() { } // expected-error {{multiple initializations given for base 'A<T>'}}
|
A<T>() { } // expected-error {{multiple initializations given for base 'A<T>'}}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -46,7 +46,7 @@ namespace Test2 {
|
|||||||
namespace Test3 {
|
namespace Test3 {
|
||||||
template<typename T> struct A {
|
template<typename T> struct A {
|
||||||
T t;
|
T t;
|
||||||
|
|
||||||
A() : t(1), // expected-note {{previous initialization is here}}
|
A() : t(1), // expected-note {{previous initialization is here}}
|
||||||
t(2) { } // expected-error {{multiple initializations given for non-static member 't'}}
|
t(2) { } // expected-error {{multiple initializations given for non-static member 't'}}
|
||||||
};
|
};
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
typedef int INT;
|
typedef int INT;
|
||||||
|
|
||||||
class Foo {
|
class Foo {
|
||||||
@ -14,7 +14,7 @@ class Foo {
|
|||||||
static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}}
|
static Foo(short, short); // expected-error{{constructor cannot be declared 'static'}}
|
||||||
virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}
|
virtual Foo(double); // expected-error{{constructor cannot be declared 'virtual'}}
|
||||||
Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}}
|
Foo(long) const; // expected-error{{'const' qualifier is not allowed on a constructor}}
|
||||||
|
|
||||||
int Foo(int, int); // expected-error{{constructor cannot have a return type}}
|
int Foo(int, int); // expected-error{{constructor cannot have a return type}}
|
||||||
|
|
||||||
volatile Foo(float); // expected-error{{constructor cannot have a return type}}
|
volatile Foo(float); // expected-error{{constructor cannot have a return type}}
|
||||||
|
@ -27,7 +27,7 @@ resumable f1() { // expected-error {{'operator new' provided by 'std::coroutine_
|
|||||||
// allocation function in resumable::promise_type have lvalue references, it looks
|
// allocation function in resumable::promise_type have lvalue references, it looks
|
||||||
// the signature of f2 is invalid. But according to [dcl.fct.def.coroutine]p4:
|
// the signature of f2 is invalid. But according to [dcl.fct.def.coroutine]p4:
|
||||||
//
|
//
|
||||||
// In the following, pi is an lvalue of type Pi, where p1 denotes the object
|
// In the following, pi is an lvalue of type Pi, where p1 denotes the object
|
||||||
// parameter and pi+1 denotes the ith non-object function parameter for a
|
// parameter and pi+1 denotes the ith non-object function parameter for a
|
||||||
// non-static member function.
|
// non-static member function.
|
||||||
//
|
//
|
||||||
@ -38,7 +38,7 @@ resumable f1() { // expected-error {{'operator new' provided by 'std::coroutine_
|
|||||||
// The lvalues p1…pn are the succeeding arguments.
|
// The lvalues p1…pn are the succeeding arguments.
|
||||||
//
|
//
|
||||||
// So the actual type passed to resumable::promise_type::operator new is lvalue
|
// So the actual type passed to resumable::promise_type::operator new is lvalue
|
||||||
// Allocator. It is allowed to convert a lvalue to a lvalue reference. So the
|
// Allocator. It is allowed to convert a lvalue to a lvalue reference. So the
|
||||||
// following one is valid.
|
// following one is valid.
|
||||||
resumable f2(Allocator &&) {
|
resumable f2(Allocator &&) {
|
||||||
co_return;
|
co_return;
|
||||||
|
@ -173,3 +173,20 @@ using alias_template = class_template<Extents...>;
|
|||||||
alias_template var2{converible_to_one{}, 2};
|
alias_template var2{converible_to_one{}, 2};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace GH136624 {
|
||||||
|
// expected-note@+1 2{{no known conversion}}
|
||||||
|
template<typename U> struct A {
|
||||||
|
U t;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename V> A(V) -> A<V>;
|
||||||
|
|
||||||
|
namespace foo {
|
||||||
|
template<class Y> using Alias = A<Y>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// FIXME: This diagnostic prints incorrect qualification for `A<int>`.
|
||||||
|
foo::Alias t = 0;
|
||||||
|
// expected-error@-1 {{no viable conversion from 'int' to 'foo::A<int>' (aka 'A<int>')}}
|
||||||
|
} // namespace GH136624
|
||||||
|
@ -607,7 +607,7 @@ namespace function_prototypes {
|
|||||||
void t0() { foo0(&bar0); }
|
void t0() { foo0(&bar0); }
|
||||||
|
|
||||||
template<class T> void foo1(fptr1<const T *>) {
|
template<class T> void foo1(fptr1<const T *>) {
|
||||||
static_assert(__is_same(T, char));
|
static_assert(__is_same(T, char));
|
||||||
}
|
}
|
||||||
void bar1(const char * __restrict);
|
void bar1(const char * __restrict);
|
||||||
void t1() { foo1(&bar1); }
|
void t1() { foo1(&bar1); }
|
||||||
|
@ -21,22 +21,22 @@ void g() {
|
|||||||
typedef A (*Func)();
|
typedef A (*Func)();
|
||||||
Func fp;
|
Func fp;
|
||||||
fp(); // expected-error {{calling function with incomplete return type 'A'}}
|
fp(); // expected-error {{calling function with incomplete return type 'A'}}
|
||||||
((Func)0)(); // expected-error {{calling function with incomplete return type 'A'}}
|
((Func)0)(); // expected-error {{calling function with incomplete return type 'A'}}
|
||||||
|
|
||||||
B b;
|
B b;
|
||||||
b.f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
|
b.f(); // expected-error {{calling 'f' with incomplete return type 'A'}}
|
||||||
|
|
||||||
b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
|
b.operator()(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
|
||||||
b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'A'}}
|
b.operator A(); // expected-error {{calling 'operator A' with incomplete return type 'A'}}
|
||||||
b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'A'}}
|
b.operator!(); // expected-error {{calling 'operator!' with incomplete return type 'A'}}
|
||||||
|
|
||||||
!b; // expected-error {{calling 'operator!' with incomplete return type 'A'}}
|
!b; // expected-error {{calling 'operator!' with incomplete return type 'A'}}
|
||||||
b(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
|
b(); // expected-error {{calling 'operator()' with incomplete return type 'A'}}
|
||||||
b++; // expected-error {{calling 'operator++' with incomplete return type 'A'}}
|
b++; // expected-error {{calling 'operator++' with incomplete return type 'A'}}
|
||||||
b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'A'}}
|
b[0]; // expected-error {{calling 'operator[]' with incomplete return type 'A'}}
|
||||||
b + 1; // expected-error {{calling 'operator+' with incomplete return type 'A'}}
|
b + 1; // expected-error {{calling 'operator+' with incomplete return type 'A'}}
|
||||||
b->f(); // expected-error {{calling 'operator->' with incomplete return type 'A'}}
|
b->f(); // expected-error {{calling 'operator->' with incomplete return type 'A'}}
|
||||||
|
|
||||||
A (B::*mfp)() = 0;
|
A (B::*mfp)() = 0;
|
||||||
(b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}}
|
(b.*mfp)(); // expected-error {{calling function with incomplete return type 'A'}}
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify -fblocks %s
|
// RUN: %clang_cc1 -fsyntax-only -std=c++98 -verify -fblocks %s
|
||||||
namespace A {
|
namespace A {
|
||||||
struct C {
|
struct C {
|
||||||
static int cx;
|
static int cx;
|
||||||
@ -111,7 +111,7 @@ void A2::CC::NC::m(); // expected-error{{out-of-line declaration of a member mus
|
|||||||
|
|
||||||
namespace E {
|
namespace E {
|
||||||
int X = 5;
|
int X = 5;
|
||||||
|
|
||||||
namespace Nested {
|
namespace Nested {
|
||||||
enum E {
|
enum E {
|
||||||
X = 0
|
X = 0
|
||||||
@ -146,7 +146,7 @@ Operators::operator bool() {
|
|||||||
|
|
||||||
namespace A {
|
namespace A {
|
||||||
void g(int&); // expected-note{{type of 1st parameter of member declaration does not match definition ('int &' vs 'const int &')}}
|
void g(int&); // expected-note{{type of 1st parameter of member declaration does not match definition ('int &' vs 'const int &')}}
|
||||||
}
|
}
|
||||||
|
|
||||||
void A::f() {} // expected-error-re{{out-of-line definition of 'f' does not match any declaration in namespace 'A'{{$}}}}
|
void A::f() {} // expected-error-re{{out-of-line definition of 'f' does not match any declaration in namespace 'A'{{$}}}}
|
||||||
|
|
||||||
@ -486,3 +486,11 @@ struct x; // expected-note {{template is declared here}}
|
|||||||
template <typename T>
|
template <typename T>
|
||||||
int issue55962 = x::a; // expected-error {{use of class template 'x' requires template arguments}} \
|
int issue55962 = x::a; // expected-error {{use of class template 'x' requires template arguments}} \
|
||||||
// expected-warning {{variable templates are a C++14 extension}}
|
// expected-warning {{variable templates are a C++14 extension}}
|
||||||
|
|
||||||
|
namespace ForwardDeclared {
|
||||||
|
typedef class A B;
|
||||||
|
struct A {
|
||||||
|
enum C {};
|
||||||
|
void F(B::C);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -14,4 +14,4 @@ typedef struct S s;
|
|||||||
const s *f();
|
const s *f();
|
||||||
s *g1() { return f(); } // expected-error{{cannot initialize return object of type 's *' (aka 'S *') with an rvalue of type 'const s *' (aka 'const S *')}}
|
s *g1() { return f(); } // expected-error{{cannot initialize return object of type 's *' (aka 'S *') with an rvalue of type 'const s *' (aka 'const S *')}}
|
||||||
|
|
||||||
B1 *g2() { return f(); } // expected-error{{cannot initialize return object of type 'B1 *' with an rvalue of type 'const s *' (aka 'const S *')}}
|
B1 *g2() { return f(); } // expected-error{{cannot initialize return object of type 'B1 *' with an rvalue of type 'const s *' (aka 'const S *')}}
|
||||||
|
@ -22,21 +22,21 @@ void cv_test(const volatile T* cvt) {
|
|||||||
void f(A* a, Foo *f, int *i, double *d, int ii) {
|
void f(A* a, Foo *f, int *i, double *d, int ii) {
|
||||||
a->~A();
|
a->~A();
|
||||||
a->A::~A();
|
a->A::~A();
|
||||||
|
|
||||||
a->~foo(); // expected-error{{undeclared identifier 'foo' in destructor name}}
|
a->~foo(); // expected-error{{undeclared identifier 'foo' in destructor name}}
|
||||||
|
|
||||||
a->~Bar(); // expected-error{{destructor type 'Bar' (aka 'Foo') in object destruction expression does not match the type 'A' of the object being destroyed}}
|
a->~Bar(); // expected-error{{destructor type 'Bar' (aka 'Foo') in object destruction expression does not match the type 'A' of the object being destroyed}}
|
||||||
|
|
||||||
f->~Bar();
|
f->~Bar();
|
||||||
f->~Foo();
|
f->~Foo();
|
||||||
i->~Bar(); // expected-error{{does not match}}
|
i->~Bar(); // expected-error{{does not match}}
|
||||||
|
|
||||||
g().~Bar(); // expected-error{{non-scalar}}
|
g().~Bar(); // expected-error{{non-scalar}}
|
||||||
|
|
||||||
f->::~Bar(); // expected-error {{not a structure or union}}
|
f->::~Bar(); // expected-error {{not a structure or union}}
|
||||||
f->::Bar::~Bar();
|
f->::Bar::~Bar();
|
||||||
f->N::~Wibble(); // expected-error{{'N' does not refer to a type}} expected-error{{'Wibble' does not refer to a type}}
|
f->N::~Wibble(); // expected-error{{'N' does not refer to a type}} expected-error{{'Wibble' does not refer to a type}}
|
||||||
|
|
||||||
f->Bar::~Bar(17, 42); // expected-error{{cannot have any arguments}}
|
f->Bar::~Bar(17, 42); // expected-error{{cannot have any arguments}}
|
||||||
|
|
||||||
i->~Integer();
|
i->~Integer();
|
||||||
|
@ -73,7 +73,7 @@ const int ret_array()[4]; // expected-error {{cannot return array}}
|
|||||||
|
|
||||||
namespace PR9328 {
|
namespace PR9328 {
|
||||||
typedef char *PCHAR;
|
typedef char *PCHAR;
|
||||||
class Test
|
class Test
|
||||||
{
|
{
|
||||||
const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}}
|
const PCHAR GetName() { return 0; } // expected-warning{{'const' type qualifier on return type has no effect}}
|
||||||
};
|
};
|
||||||
@ -109,7 +109,7 @@ namespace return_has_expr {
|
|||||||
// pr17759
|
// pr17759
|
||||||
namespace ctor_returns_void {
|
namespace ctor_returns_void {
|
||||||
void f() {}
|
void f() {}
|
||||||
struct S {
|
struct S {
|
||||||
S() { return f(); } // expected-error {{constructor 'S' must not return void expression}}
|
S() { return f(); } // expected-error {{constructor 'S' must not return void expression}}
|
||||||
~S() { return f(); } // expected-error {{destructor '~S' must not return void expression}}
|
~S() { return f(); } // expected-error {{destructor '~S' must not return void expression}}
|
||||||
};
|
};
|
||||||
|
@ -414,6 +414,9 @@ struct PotentiallyFinal<T*> final { };
|
|||||||
template<>
|
template<>
|
||||||
struct PotentiallyFinal<int> final { };
|
struct PotentiallyFinal<int> final { };
|
||||||
|
|
||||||
|
struct FwdDeclFinal;
|
||||||
|
using FwdDeclFinalAlias = FwdDeclFinal;
|
||||||
|
struct FwdDeclFinal final {};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -423,6 +426,8 @@ void is_final()
|
|||||||
static_assert(__is_final(FinalClass));
|
static_assert(__is_final(FinalClass));
|
||||||
static_assert(__is_final(PotentiallyFinal<float*>));
|
static_assert(__is_final(PotentiallyFinal<float*>));
|
||||||
static_assert(__is_final(PotentiallyFinal<int>));
|
static_assert(__is_final(PotentiallyFinal<int>));
|
||||||
|
static_assert(__is_final(FwdDeclFinal));
|
||||||
|
static_assert(__is_final(FwdDeclFinalAlias));
|
||||||
|
|
||||||
static_assert(!__is_final(int));
|
static_assert(!__is_final(int));
|
||||||
static_assert(!__is_final(Union));
|
static_assert(!__is_final(Union));
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
|
||||||
// expected-no-diagnostics
|
|
||||||
|
|
||||||
namespace A {
|
|
||||||
struct B { };
|
|
||||||
void operator+(B,B);
|
|
||||||
}
|
|
||||||
|
|
||||||
using A::operator+;
|
|
25
clang/test/SemaCXX/using-decl.cpp
Normal file
25
clang/test/SemaCXX/using-decl.cpp
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
|
|
||||||
|
namespace PR4441 {
|
||||||
|
namespace A {
|
||||||
|
struct B { };
|
||||||
|
void operator+(B,B);
|
||||||
|
}
|
||||||
|
|
||||||
|
using A::operator+;
|
||||||
|
} // namespace PR4441
|
||||||
|
|
||||||
|
namespace qualified_name {
|
||||||
|
namespace XXX {
|
||||||
|
struct A {
|
||||||
|
using type = int;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace YYY {
|
||||||
|
using XXX::A;
|
||||||
|
}
|
||||||
|
|
||||||
|
YYY::A::type x = nullptr;
|
||||||
|
// expected-error@-1 {{variable of type 'YYY::A::type'}}
|
||||||
|
} // namespace qualifed_name
|
@ -16,7 +16,7 @@ namespace T2 {
|
|||||||
|
|
||||||
struct a { };
|
struct a { };
|
||||||
struct b { };
|
struct b { };
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
virtual a* f(); // expected-note{{overridden virtual function is here}}
|
virtual a* f(); // expected-note{{overridden virtual function is here}}
|
||||||
virtual int *g(); // expected-note{{overridden virtual function is here}}
|
virtual int *g(); // expected-note{{overridden virtual function is here}}
|
||||||
@ -33,7 +33,7 @@ namespace T3 {
|
|||||||
|
|
||||||
struct a { };
|
struct a { };
|
||||||
struct b : private a { }; // expected-note{{declared private here}}
|
struct b : private a { }; // expected-note{{declared private here}}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
virtual a* f(); // FIXME: desired-note{{overridden virtual function is here}}
|
virtual a* f(); // FIXME: desired-note{{overridden virtual function is here}}
|
||||||
};
|
};
|
||||||
@ -49,7 +49,7 @@ namespace T4 {
|
|||||||
struct a { };
|
struct a { };
|
||||||
struct a1 : a { };
|
struct a1 : a { };
|
||||||
struct b : a, a1 { }; // expected-warning{{direct base 'a' is inaccessible due to ambiguity:\n struct T4::b -> a\n struct T4::b -> a1 -> a}}
|
struct b : a, a1 { }; // expected-warning{{direct base 'a' is inaccessible due to ambiguity:\n struct T4::b -> a\n struct T4::b -> a1 -> a}}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
virtual a* f(); // expected-note{{overridden virtual function is here}}
|
virtual a* f(); // expected-note{{overridden virtual function is here}}
|
||||||
};
|
};
|
||||||
@ -63,23 +63,23 @@ class B : A {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace T5 {
|
namespace T5 {
|
||||||
|
|
||||||
struct a { };
|
struct a { };
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
virtual a* const f();
|
virtual a* const f();
|
||||||
virtual a* const g(); // expected-note{{overridden virtual function is here}}
|
virtual a* const g(); // expected-note{{overridden virtual function is here}}
|
||||||
};
|
};
|
||||||
|
|
||||||
class B : A {
|
class B : A {
|
||||||
virtual a* const f();
|
virtual a* const f();
|
||||||
virtual a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides ('a *' has different qualifiers than 'a *const')}}
|
virtual a* g(); // expected-error{{return type of virtual function 'g' is not covariant with the return type of the function it overrides ('a *' has different qualifiers than 'a *const')}}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace T6 {
|
namespace T6 {
|
||||||
|
|
||||||
struct a { };
|
struct a { };
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
@ -150,11 +150,11 @@ namespace T7 {
|
|||||||
namespace T8 {
|
namespace T8 {
|
||||||
struct a { };
|
struct a { };
|
||||||
struct b; // expected-note {{forward declaration of 'T8::b'}}
|
struct b; // expected-note {{forward declaration of 'T8::b'}}
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
virtual a *f();
|
virtual a *f();
|
||||||
};
|
};
|
||||||
|
|
||||||
class B : A {
|
class B : A {
|
||||||
b* f(); // expected-error {{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('b' is incomplete)}}
|
b* f(); // expected-error {{return type of virtual function 'f' is not covariant with the return type of the function it overrides ('b' is incomplete)}}
|
||||||
};
|
};
|
||||||
@ -162,15 +162,15 @@ namespace T8 {
|
|||||||
|
|
||||||
namespace T9 {
|
namespace T9 {
|
||||||
struct a { };
|
struct a { };
|
||||||
|
|
||||||
template<typename T> struct b : a {
|
template<typename T> struct b : a {
|
||||||
int a[sizeof(T) ? -1 : -1]; // expected-error {{array with a negative size}}
|
int a[sizeof(T) ? -1 : -1]; // expected-error {{array with a negative size}}
|
||||||
};
|
};
|
||||||
|
|
||||||
class A {
|
class A {
|
||||||
virtual a *f();
|
virtual a *f();
|
||||||
};
|
};
|
||||||
|
|
||||||
class B : A {
|
class B : A {
|
||||||
virtual b<int> *f(); // expected-note {{in instantiation of template class 'T9::b<int>' requested here}}
|
virtual b<int> *f(); // expected-note {{in instantiation of template class 'T9::b<int>' requested here}}
|
||||||
};
|
};
|
||||||
@ -185,7 +185,7 @@ class X1 : public X0 {
|
|||||||
};
|
};
|
||||||
|
|
||||||
template <typename Base>
|
template <typename Base>
|
||||||
struct Foo : Base {
|
struct Foo : Base {
|
||||||
void f(int) = 0; // expected-error{{not virtual and cannot be declared pure}}
|
void f(int) = 0; // expected-error{{not virtual and cannot be declared pure}}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ namespace T10 {
|
|||||||
struct A { };
|
struct A { };
|
||||||
struct B : A { };
|
struct B : A { };
|
||||||
|
|
||||||
struct C {
|
struct C {
|
||||||
virtual A&& f();
|
virtual A&& f();
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ namespace T11 {
|
|||||||
struct A { };
|
struct A { };
|
||||||
struct B : A { };
|
struct B : A { };
|
||||||
|
|
||||||
struct C {
|
struct C {
|
||||||
virtual A& f(); // expected-note {{overridden virtual function is here}}
|
virtual A& f(); // expected-note {{overridden virtual function is here}}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ namespace T12 {
|
|||||||
struct A { };
|
struct A { };
|
||||||
struct B : A { };
|
struct B : A { };
|
||||||
|
|
||||||
struct C {
|
struct C {
|
||||||
virtual A&& f(); // expected-note {{overridden virtual function is here}}
|
virtual A&& f(); // expected-note {{overridden virtual function is here}}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -331,3 +331,13 @@ namespace PR8168 {
|
|||||||
static void foo() {} // expected-error{{'static' member function 'foo' overrides a virtual function}}
|
static void foo() {} // expected-error{{'static' member function 'foo' overrides a virtual function}}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace ForwardDeclared {
|
||||||
|
class A;
|
||||||
|
struct B {
|
||||||
|
virtual B *f();
|
||||||
|
};
|
||||||
|
struct A : B {
|
||||||
|
A *f();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
@ -75,6 +75,8 @@ void m() {
|
|||||||
while (true) {}
|
while (true) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void n() { ::n(); } // expected-warning{{call itself}}
|
||||||
|
|
||||||
class S {
|
class S {
|
||||||
static void a();
|
static void a();
|
||||||
void b();
|
void b();
|
||||||
|
@ -30,7 +30,7 @@ void to_cf(id obj) {
|
|||||||
CFTypeRef cf1 = (__bridge_retained IdType)CreateSomething();
|
CFTypeRef cf1 = (__bridge_retained IdType)CreateSomething();
|
||||||
CFStringRef cf2 = (__bridge_retained StringType)CreateNSString();
|
CFStringRef cf2 = (__bridge_retained StringType)CreateNSString();
|
||||||
CFTypeRef cf3 = (__bridge IdType)CreateSomething();
|
CFTypeRef cf3 = (__bridge IdType)CreateSomething();
|
||||||
CFStringRef cf4 = (__bridge StringType)CreateNSString();
|
CFStringRef cf4 = (__bridge StringType)CreateNSString();
|
||||||
}
|
}
|
||||||
|
|
||||||
template void to_cf<CFTypeRef, CFStringRef>(id);
|
template void to_cf<CFTypeRef, CFStringRef>(id);
|
||||||
|
@ -229,3 +229,14 @@ namespace DefaultArgVsPartialSpec {
|
|||||||
> struct S;
|
> struct S;
|
||||||
template<typename T> struct S<T> {}; // expected-error {{non-type template argument specializes a template parameter with dependent type 'T'}}
|
template<typename T> struct S<T> {}; // expected-error {{non-type template argument specializes a template parameter with dependent type 'T'}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace LateDefined {
|
||||||
|
template <class> struct A;
|
||||||
|
struct B {
|
||||||
|
typedef A<B> X;
|
||||||
|
};
|
||||||
|
template <> struct A<B> {
|
||||||
|
void f();
|
||||||
|
};
|
||||||
|
void A<B>::f() {}
|
||||||
|
}
|
||||||
|
@ -39,11 +39,11 @@ struct X0 {
|
|||||||
void g1(T&); // expected-note{{previous}}
|
void g1(T&); // expected-note{{previous}}
|
||||||
void g1(typename X0::U_type&);
|
void g1(typename X0::U_type&);
|
||||||
void g1(typename X0<T, U>::T_type&); // expected-error{{redecl}}
|
void g1(typename X0<T, U>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g2(T&); // expected-note{{previous}}
|
void g2(T&); // expected-note{{previous}}
|
||||||
void g2(typename X0::U_type&);
|
void g2(typename X0::U_type&);
|
||||||
void g2(typename X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
|
void g2(typename X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g3(T&); // expected-note{{previous}}
|
void g3(T&); // expected-note{{previous}}
|
||||||
void g3(typename X0::U_type&);
|
void g3(typename X0::U_type&);
|
||||||
void g3(typename ::X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
|
void g3(typename ::X0<T_type, U_type>::T_type&); // expected-error{{redecl}}
|
||||||
@ -77,19 +77,19 @@ struct X0<T*, U*> {
|
|||||||
typedef U U_type;
|
typedef U U_type;
|
||||||
typedef T* Tptr;
|
typedef T* Tptr;
|
||||||
typedef U* Uptr;
|
typedef U* Uptr;
|
||||||
|
|
||||||
void f0(T&); // expected-note{{previous}}
|
void f0(T&); // expected-note{{previous}}
|
||||||
void f0(typename X0::U_type&);
|
void f0(typename X0::U_type&);
|
||||||
void f0(typename X0::T_type&); // expected-error{{redecl}}
|
void f0(typename X0::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void f1(T&); // expected-note{{previous}}
|
void f1(T&); // expected-note{{previous}}
|
||||||
void f1(typename X0::U_type&);
|
void f1(typename X0::U_type&);
|
||||||
void f1(typename X0<T*, U*>::T_type&); // expected-error{{redecl}}
|
void f1(typename X0<T*, U*>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void f2(T&); // expected-note{{previous}}
|
void f2(T&); // expected-note{{previous}}
|
||||||
void f2(typename X0::U_type&);
|
void f2(typename X0::U_type&);
|
||||||
void f2(typename X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
void f2(typename X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void f3(T&); // expected-note{{previous}}
|
void f3(T&); // expected-note{{previous}}
|
||||||
void f3(typename X0::U_type&);
|
void f3(typename X0::U_type&);
|
||||||
void f3(typename ::X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
void f3(typename ::X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
||||||
@ -97,46 +97,46 @@ struct X0<T*, U*> {
|
|||||||
void f4(T&); // expected-note{{previous}}
|
void f4(T&); // expected-note{{previous}}
|
||||||
void f4(typename X0::U_type&);
|
void f4(typename X0::U_type&);
|
||||||
void f4(typename ::X0<Tptr, Uptr>::T_type&); // expected-error{{redecl}}
|
void f4(typename ::X0<Tptr, Uptr>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void f5(X0*); // expected-note{{previous}}
|
void f5(X0*); // expected-note{{previous}}
|
||||||
void f5(::X0<T, U>*);
|
void f5(::X0<T, U>*);
|
||||||
void f5(::X0<T*, U*>*); // expected-error{{redecl}}
|
void f5(::X0<T*, U*>*); // expected-error{{redecl}}
|
||||||
|
|
||||||
struct X2 {
|
struct X2 {
|
||||||
typedef T my_T_type;
|
typedef T my_T_type;
|
||||||
|
|
||||||
void g0(T&); // expected-note{{previous}}
|
void g0(T&); // expected-note{{previous}}
|
||||||
void g0(typename X0::U_type&);
|
void g0(typename X0::U_type&);
|
||||||
void g0(typename X0::T_type&); // expected-error{{redecl}}
|
void g0(typename X0::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g1(T&); // expected-note{{previous}}
|
void g1(T&); // expected-note{{previous}}
|
||||||
void g1(typename X0::U_type&);
|
void g1(typename X0::U_type&);
|
||||||
void g1(typename X0<T*, U*>::T_type&); // expected-error{{redecl}}
|
void g1(typename X0<T*, U*>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g2(T&); // expected-note{{previous}}
|
void g2(T&); // expected-note{{previous}}
|
||||||
void g2(typename X0::U_type&);
|
void g2(typename X0::U_type&);
|
||||||
void g2(typename X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
void g2(typename X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g3(T&); // expected-note{{previous}}
|
void g3(T&); // expected-note{{previous}}
|
||||||
void g3(typename X0::U_type&);
|
void g3(typename X0::U_type&);
|
||||||
void g3(typename ::X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
void g3(typename ::X0<T_type*, U_type*>::T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g4(T&); // expected-note{{previous}}
|
void g4(T&); // expected-note{{previous}}
|
||||||
void g4(typename X0::U_type&);
|
void g4(typename X0::U_type&);
|
||||||
void g4(typename X2::my_T_type&); // expected-error{{redecl}}
|
void g4(typename X2::my_T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g5(T&); // expected-note{{previous}}
|
void g5(T&); // expected-note{{previous}}
|
||||||
void g5(typename X0::U_type&);
|
void g5(typename X0::U_type&);
|
||||||
void g5(typename X0::X2::my_T_type&); // expected-error{{redecl}}
|
void g5(typename X0::X2::my_T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g6(T&); // expected-note{{previous}}
|
void g6(T&); // expected-note{{previous}}
|
||||||
void g6(typename X0::U_type&);
|
void g6(typename X0::U_type&);
|
||||||
void g6(typename X0<T*, U*>::X2::my_T_type&); // expected-error{{redecl}}
|
void g6(typename X0<T*, U*>::X2::my_T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g7(T&); // expected-note{{previous}}
|
void g7(T&); // expected-note{{previous}}
|
||||||
void g7(typename X0::U_type&);
|
void g7(typename X0::U_type&);
|
||||||
void g7(typename ::X0<typename X2::my_T_type*, U_type*>::X2::my_T_type&); // expected-error{{redecl}}
|
void g7(typename ::X0<typename X2::my_T_type*, U_type*>::X2::my_T_type&); // expected-error{{redecl}}
|
||||||
|
|
||||||
void g8(T&); // expected-note{{previous}}
|
void g8(T&); // expected-note{{previous}}
|
||||||
void g8(typename X0<U, T_type>::T_type&);
|
void g8(typename X0<U, T_type>::T_type&);
|
||||||
void g8(typename ::X0<typename X0<T_type*, U*>::X2::my_T_type*, U_type*>::X2::my_T_type&); // expected-error{{redecl}}
|
void g8(typename ::X0<typename X0<T_type*, U*>::X2::my_T_type*, U_type*>::X2::my_T_type&); // expected-error{{redecl}}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
|
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
struct X0 : T::template apply<U> {
|
struct X0 : T::template apply<U> {
|
||||||
X0(U u) : T::template apply<U>(u) { }
|
X0(U u) : T::template apply<U>(u) { }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ namespace PR6081 {
|
|||||||
struct A { };
|
struct A { };
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
class B : public A<T>
|
class B : public A<T>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
template< class X >
|
template< class X >
|
||||||
@ -109,9 +109,9 @@ namespace PR6081 {
|
|||||||
|
|
||||||
namespace PR6413 {
|
namespace PR6413 {
|
||||||
template <typename T> class Base_A { };
|
template <typename T> class Base_A { };
|
||||||
|
|
||||||
class Base_B { };
|
class Base_B { };
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class Derived
|
class Derived
|
||||||
: public virtual Base_A<T>
|
: public virtual Base_A<T>
|
||||||
@ -120,12 +120,12 @@ namespace PR6413 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
namespace PR5812 {
|
namespace PR5812 {
|
||||||
template <class T> struct Base {
|
template <class T> struct Base {
|
||||||
Base* p;
|
Base* p;
|
||||||
};
|
};
|
||||||
|
|
||||||
template <class T> struct Derived: public Base<T> {
|
template <class T> struct Derived: public Base<T> {
|
||||||
typename Derived::Base* p; // meaning Derived::Base<T>
|
typename Derived::Base* p; // meaning Derived::Base<T>
|
||||||
};
|
};
|
||||||
|
|
||||||
Derived<int> di;
|
Derived<int> di;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fcxx-exceptions -Wno-dynamic-exception-spec %std_cxx11- %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -fexceptions -fcxx-exceptions -Wno-dynamic-exception-spec -pedantic %std_cxx11- %s
|
||||||
|
|
||||||
template void *; // expected-error{{expected unqualified-id}}
|
template void *; // expected-error{{expected unqualified-id}}
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ template int v0; // expected-error{{does not refer}}
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
struct X0 {
|
struct X0 {
|
||||||
static T value;
|
static T value;
|
||||||
|
|
||||||
T f0(T x) {
|
T f0(T x) {
|
||||||
return x + 1; // expected-error{{invalid operands}}
|
return x + 1; // expected-error{{invalid operands}}
|
||||||
}
|
}
|
||||||
@ -45,7 +45,7 @@ template MemPtr X0<MemPtr>::f0(MemPtr); // expected-note{{requested here}}
|
|||||||
|
|
||||||
struct X2 {
|
struct X2 {
|
||||||
int f0(int); // expected-note{{refers here}}
|
int f0(int); // expected-note{{refers here}}
|
||||||
|
|
||||||
template<typename T> T f1(T) { return T(); }
|
template<typename T> T f1(T) { return T(); }
|
||||||
template<typename T> T* f1(T*) { return 0; }
|
template<typename T> T* f1(T*) { return 0; }
|
||||||
|
|
||||||
@ -185,3 +185,12 @@ template<typename T> struct LambdaInDefaultMemberInitInExplicitInstantiation {
|
|||||||
template struct LambdaInDefaultMemberInitInExplicitInstantiation<int>;
|
template struct LambdaInDefaultMemberInitInExplicitInstantiation<int>;
|
||||||
LambdaInDefaultMemberInitInExplicitInstantiation<float> x;
|
LambdaInDefaultMemberInitInExplicitInstantiation<float> x;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
namespace Qualified {
|
||||||
|
template <class> struct C {
|
||||||
|
struct D {
|
||||||
|
void f();
|
||||||
|
};
|
||||||
|
};
|
||||||
|
extern template void C<int>::D::f();
|
||||||
|
}
|
||||||
|
@ -2,28 +2,28 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
||||||
|
|
||||||
namespace N {
|
namespace N {
|
||||||
namespace M {
|
namespace M {
|
||||||
template<typename T> struct Promote;
|
template<typename T> struct Promote;
|
||||||
|
|
||||||
template<> struct Promote<short> {
|
template<> struct Promote<short> {
|
||||||
typedef int type;
|
typedef int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct Promote<int> {
|
template<> struct Promote<int> {
|
||||||
typedef int type;
|
typedef int type;
|
||||||
};
|
};
|
||||||
|
|
||||||
template<> struct Promote<float> {
|
template<> struct Promote<float> {
|
||||||
typedef double type;
|
typedef double type;
|
||||||
};
|
};
|
||||||
|
|
||||||
Promote<short>::type *ret_intptr(int* ip) { return ip; }
|
Promote<short>::type *ret_intptr(int* ip) { return ip; }
|
||||||
Promote<int>::type *ret_intptr2(int* ip) { return ip; }
|
Promote<int>::type *ret_intptr2(int* ip) { return ip; }
|
||||||
}
|
}
|
||||||
|
|
||||||
M::Promote<int>::type *ret_intptr3(int* ip) { return ip; }
|
M::Promote<int>::type *ret_intptr3(int* ip) { return ip; }
|
||||||
M::template Promote<int>::type *ret_intptr4(int* ip) { return ip; }
|
M::template Promote<int>::type *ret_intptr4(int* ip) { return ip; }
|
||||||
#if __cplusplus <= 199711L
|
#if __cplusplus <= 199711L
|
||||||
// expected-warning@-2 {{'template' keyword outside of a template}}
|
// expected-warning@-2 {{'template' keyword outside of a template}}
|
||||||
#endif
|
#endif
|
||||||
@ -87,7 +87,7 @@ namespace PR7385 {
|
|||||||
template< typename > struct has_xxx0_introspect
|
template< typename > struct has_xxx0_introspect
|
||||||
{
|
{
|
||||||
template< typename > struct has_xxx0_substitute ;
|
template< typename > struct has_xxx0_substitute ;
|
||||||
template< typename V >
|
template< typename V >
|
||||||
int int00( has_xxx0_substitute < typename V::template xxx< > > = 0 );
|
int int00( has_xxx0_substitute < typename V::template xxx< > > = 0 );
|
||||||
};
|
};
|
||||||
static const int value = has_xxx0_introspect<int>::value; // expected-error{{no member named 'value'}}
|
static const int value = has_xxx0_introspect<int>::value; // expected-error{{no member named 'value'}}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
|
||||||
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
|
||||||
template<typename T, typename U>
|
template<typename T, typename U>
|
||||||
struct is_same {
|
struct is_same {
|
||||||
static const bool value = false;
|
static const bool value = false;
|
||||||
};
|
};
|
||||||
@ -26,10 +26,10 @@ struct make_pair {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
int a0[is_same<metafun_apply2<make_pair, int, float>::type,
|
int a0[is_same<metafun_apply2<make_pair, int, float>::type,
|
||||||
pair<int, float> >::value? 1 : -1];
|
pair<int, float> >::value? 1 : -1];
|
||||||
int a1[is_same<
|
int a1[is_same<
|
||||||
typename make_pair::template apply<int, float>,
|
typename make_pair::template apply<int, float>,
|
||||||
#if __cplusplus <= 199711L // C++03 and earlier modes
|
#if __cplusplus <= 199711L // C++03 and earlier modes
|
||||||
// expected-warning@-2 {{'template' keyword outside of a template}}
|
// expected-warning@-2 {{'template' keyword outside of a template}}
|
||||||
// expected-warning@-3 {{'typename' outside of a template is a C++11 extension}}
|
// expected-warning@-3 {{'typename' outside of a template is a C++11 extension}}
|
||||||
@ -46,7 +46,7 @@ struct swap_and_apply2 {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
int a2[is_same<swap_and_apply2<make_pair>::apply<int, float>::type,
|
int a2[is_same<swap_and_apply2<make_pair>::apply<int, float>::type,
|
||||||
pair<float, int> >::value? 1 : -1];
|
pair<float, int> >::value? 1 : -1];
|
||||||
|
|
||||||
template<typename MetaFun>
|
template<typename MetaFun>
|
||||||
@ -57,14 +57,14 @@ struct swap_and_apply2b {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
int a3[is_same<swap_and_apply2b<make_pair>::apply<int, float>::type,
|
int a3[is_same<swap_and_apply2b<make_pair>::apply<int, float>::type,
|
||||||
pair<float, int> >::value? 1 : -1];
|
pair<float, int> >::value? 1 : -1];
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct X0 {
|
struct X0 {
|
||||||
template<typename U, typename V>
|
template<typename U, typename V>
|
||||||
struct Inner;
|
struct Inner;
|
||||||
|
|
||||||
void f0(X0<T>::Inner<T*, T&>); // expected-note{{here}}
|
void f0(X0<T>::Inner<T*, T&>); // expected-note{{here}}
|
||||||
void f0(typename X0<T>::Inner<T*, T&>); // expected-error{{redecl}}
|
void f0(typename X0<T>::Inner<T*, T&>); // expected-error{{redecl}}
|
||||||
|
|
||||||
@ -77,10 +77,10 @@ struct X0 {
|
|||||||
|
|
||||||
namespace PR6236 {
|
namespace PR6236 {
|
||||||
template<typename T, typename U> struct S { };
|
template<typename T, typename U> struct S { };
|
||||||
|
|
||||||
template<typename T> struct S<T, T> {
|
template<typename T> struct S<T, T> {
|
||||||
template<typename U> struct K { };
|
template<typename U> struct K { };
|
||||||
|
|
||||||
void f() {
|
void f() {
|
||||||
typedef typename S<T, T>::template K<T> Foo;
|
typedef typename S<T, T>::template K<T> Foo;
|
||||||
}
|
}
|
||||||
@ -111,9 +111,9 @@ namespace PR6463 {
|
|||||||
struct C { typedef const int type; }; // expected-note 2{{member type 'const int' found by ambiguous name lookup}}
|
struct C { typedef const int type; }; // expected-note 2{{member type 'const int' found by ambiguous name lookup}}
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
struct A : B, C {
|
struct A : B, C {
|
||||||
type& a(); // expected-error{{found in multiple base classes}}
|
type& a(); // expected-error{{found in multiple base classes}}
|
||||||
int x;
|
int x;
|
||||||
};
|
};
|
||||||
|
|
||||||
// FIXME: Improve source location info here.
|
// FIXME: Improve source location info here.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user