Add some random C++ standard tests.

llvm-svn: 73287
This commit is contained in:
Daniel Dunbar 2009-06-13 06:16:36 +00:00
parent 7a1095f243
commit 4be788c56a
7 changed files with 74 additions and 0 deletions

View File

@ -0,0 +1,11 @@
// RUN: clang-cc -verify %s
// XFAIL
void f0(void) {
inline void f1(); // expected-error {{'inline' is not allowed on block scope function declaration}}
}
// FIXME: Add test for "If the inline specifier is used in a friend declaration,
// that declaration shall be a definition or the function shall have previously
// been declared inline.

View File

@ -0,0 +1,7 @@
// RUN: clang-cc -verify %s
// XFAIL
void f0() {
}
inline void f0(); // expected-error {{function definition cannot preceed inline declaration}}

View File

@ -0,0 +1,13 @@
// RUN: clang-cc -verify %s
// XFAIL
class A {
public:
explicit A();
explicit operator int(); // expected-warning {{explicit conversion functions are a C++0x extension}}
explicit void f0(); // expected-error {{'explicit' cannot only be applied to constructor or conversion function}}
};
explicit A::A() { } // expected-error {{'explicit' cannot be specified outside class definition}}

View File

@ -0,0 +1,14 @@
// RUN: clang-cc -verify %s
// XFAIL
typedef const int T0;
typedef int& T1;
struct s0 {
mutable const int f0; // expected-error{{'mutable' and 'const' cannot be mixed}}
mutable T0 f1; // expected-error{{'mutable' and 'const' cannot be mixed}}
mutable int &f2; // expected-error{{'mutable' cannot be applied to references}}
mutable T1 f3; // expected-error{{'mutable' cannot be applied to references}}
mutable struct s1 {}; // expected-error{{'mutable' cannot be applied to non-data members}}
mutable void im0(); // expected-error{{'mutable' cannot be applied to functions}}
};

View File

@ -0,0 +1,12 @@
// RUN: clang-cc -verify %s
struct S; // expected-note {{forward declaration of 'struct S'}}
extern S a;
extern S f();
extern void g(S a); // expected-note {{candidate function}}
void h() {
// FIXME: This diagnostic could be better.
g(a); // expected-error {{no matching function for call to 'g'}}
f(); // expected-error {{return type of called function ('struct S') is incomplete}}
}

View File

@ -0,0 +1,8 @@
// RUN: clang-cc -verify %s
typedef struct s { int x; } s;
typedef int I;
typedef int I2;
typedef I2 I; // expected-note {{previous definition is here}}
typedef char I; // expected-error {{typedef redefinition with different types}}

View File

@ -0,0 +1,9 @@
// RUN: clang-cc -verify %s
// XFAIL
struct S {
typedef struct A {} A; // expected-note {{previous definition is here}}
typedef struct B B;
typedef A A; // expected-error {{redefinition of 'A'}}
};