2011-10-13 22:29:44 +00:00
|
|
|
// RUN: %clang_cc1 -verify -std=c++11 %s
|
2010-04-24 01:30:46 +00:00
|
|
|
// RUN: cp %s %t
|
2011-10-13 22:29:44 +00:00
|
|
|
// RUN: not %clang_cc1 -x c++ -std=c++11 -fixit %t
|
|
|
|
// RUN: %clang_cc1 -Wall -pedantic -x c++ -std=c++11 %t
|
2009-11-23 13:46:08 +00:00
|
|
|
|
|
|
|
/* This is a test of the various code modification hints that only
|
|
|
|
apply in C++0x. */
|
2010-04-24 01:30:46 +00:00
|
|
|
struct A {
|
2009-11-23 13:46:08 +00:00
|
|
|
explicit operator int(); // expected-note{{conversion to integral type}}
|
|
|
|
};
|
|
|
|
|
2010-04-24 01:30:46 +00:00
|
|
|
void x() {
|
2009-11-23 13:46:08 +00:00
|
|
|
switch(A()) { // expected-error{{explicit conversion to}}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-15 14:24:37 +00:00
|
|
|
using ::T = void; // expected-error {{name defined in alias declaration must be an identifier}}
|
|
|
|
using typename U = void; // expected-error {{name defined in alias declaration must be an identifier}}
|
|
|
|
using typename ::V = void; // expected-error {{name defined in alias declaration must be an identifier}}
|
2011-09-29 19:11:37 +00:00
|
|
|
|
|
|
|
namespace Constexpr {
|
|
|
|
extern constexpr int a; // expected-error {{must be a definition}}
|
|
|
|
// -> extern const int a;
|
|
|
|
|
|
|
|
extern constexpr int *b; // expected-error {{must be a definition}}
|
|
|
|
// -> extern int *const b;
|
|
|
|
|
|
|
|
extern constexpr int &c; // expected-error {{must be a definition}}
|
|
|
|
// -> extern int &b;
|
|
|
|
|
|
|
|
extern constexpr const int d; // expected-error {{must be a definition}}
|
|
|
|
// -> extern const int d;
|
|
|
|
|
|
|
|
int z;
|
|
|
|
constexpr int a = 0;
|
|
|
|
constexpr int *b = &z;
|
|
|
|
constexpr int &c = z;
|
|
|
|
constexpr int d = a;
|
|
|
|
|
|
|
|
// FIXME: Provide FixIts for static data members too.
|
|
|
|
#if 0
|
|
|
|
struct S {
|
|
|
|
static constexpr int b; // xpected-error {{requires an initializer}}
|
|
|
|
// -> const int b;
|
|
|
|
};
|
|
|
|
|
|
|
|
constexpr int S::b = 0;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
struct S {
|
2011-09-29 23:18:34 +00:00
|
|
|
static char *const p = 0; // expected-error {{requires 'constexpr' specifier}}
|
2011-09-29 19:11:37 +00:00
|
|
|
// -> constexpr static char *const p = 0;
|
|
|
|
};
|
|
|
|
}
|
2011-10-19 21:33:05 +00:00
|
|
|
|
|
|
|
namespace SemiCommaTypo {
|
|
|
|
int m {},
|
|
|
|
n [[]], // expected-error {{expected ';' at end of declaration}}
|
|
|
|
int o;
|
|
|
|
}
|