summaryrefslogtreecommitdiffstats
path: root/test/FixIt/fixit-cxx0x.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/FixIt/fixit-cxx0x.cpp')
-rw-r--r--test/FixIt/fixit-cxx0x.cpp108
1 files changed, 82 insertions, 26 deletions
diff --git a/test/FixIt/fixit-cxx0x.cpp b/test/FixIt/fixit-cxx0x.cpp
index 7331645..b6cc2c0 100644
--- a/test/FixIt/fixit-cxx0x.cpp
+++ b/test/FixIt/fixit-cxx0x.cpp
@@ -18,37 +18,93 @@ using ::T = void; // expected-error {{name defined in alias declaration must be
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}}
-namespace Constexpr {
- extern constexpr int a; // expected-error {{must be a definition}}
- // -> extern const int a;
+namespace SemiCommaTypo {
+ int m {},
+ n [[]], // expected-error {{expected ';' at end of declaration}}
+ int o;
- 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;
+ struct Base {
+ virtual void f2(), f3();
+ };
+ struct MemberDeclarator : Base {
+ int k : 4,
+ //[[]] : 1, FIXME: test this once we support attributes here
+ : 9, // expected-error {{expected ';' at end of declaration}}
+ char c, // expected-error {{expected ';' at end of declaration}}
+ typedef void F(), // expected-error {{expected ';' at end of declaration}}
+ F f1,
+ f2 final,
+ f3 override, // expected-error {{expected ';' at end of declaration}}
+ };
+}
- int z;
- constexpr int a = 0;
- constexpr int *b = &z;
- constexpr int &c = z;
- constexpr int d = a;
+namespace ScopedEnum {
+ enum class E { a };
- // FIXME: Provide FixIts for static data members too.
-#if 0
+ enum class E b = E::a; // expected-error {{must use 'enum' not 'enum class'}}
struct S {
- static constexpr int b; // xpected-error {{requires an initializer}}
- // -> const int b;
+ friend enum class E; // expected-error {{must use 'enum' not 'enum class'}}
};
+}
- constexpr int S::b = 0;
-#endif
+struct S2 {
+ void f(int i);
+ void g(int i);
+};
- struct S {
- static char *const p = 0; // expected-error {{requires 'constexpr' specifier}}
- // -> constexpr static char *const p = 0;
- };
+void S2::f(int i) {
+ (void)[&, &i, &i]{}; // expected-error 2{{'&' cannot precede a capture when the capture default is '&'}}
+ (void)[=, this]{ this->g(5); }; // expected-error{{'this' cannot be explicitly captured}}
+ (void)[i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
+ (void)[&, i, i]{ }; // expected-error{{'i' can appear only once in a capture list}}
+ (void)[] mutable { }; // expected-error{{lambda requires '()' before 'mutable'}}
+ (void)[] -> int { }; // expected-error{{lambda requires '()' before return type}}
}
+
+#define bar "bar"
+const char *p = "foo"bar; // expected-error {{requires a space between}}
+#define ord - '0'
+int k = '4'ord; // expected-error {{requires a space between}}
+
+void operator""_x(char); // expected-error {{requires a space}}
+void operator"x" _y(char); // expected-error {{must be '""'}}
+void operator L"" _z(char); // expected-error {{encoding prefix}}
+void operator "x" "y" U"z" ""_whoops "z" "y"(char); // expected-error {{must be '""'}}
+
+void f() {
+ 'a'_x;
+ 'b'_y;
+ 'c'_z;
+ 'd'_whoops;
+}
+
+template<typename ...Ts> struct MisplacedEllipsis {
+ int a(Ts ...(x)); // expected-error {{'...' must immediately precede declared identifier}}
+ int b(Ts ...&x); // expected-error {{'...' must immediately precede declared identifier}}
+ int c(Ts ...&); // expected-error {{'...' must be innermost component of anonymous pack declaration}}
+ int d(Ts ...(...&...)); // expected-error 2{{'...' must be innermost component of anonymous pack declaration}}
+ int e(Ts ...*[]); // expected-error {{'...' must be innermost component of anonymous pack declaration}}
+ int f(Ts ...(...*)()); // expected-error 2{{'...' must be innermost component of anonymous pack declaration}}
+ int g(Ts ...()); // ok
+};
+namespace TestMisplacedEllipsisRecovery {
+ MisplacedEllipsis<int, char> me;
+ int i; char k;
+ int *ip; char *kp;
+ int ifn(); char kfn();
+ int a = me.a(i, k);
+ int b = me.b(i, k);
+ int c = me.c(i, k);
+ int d = me.d(i, k);
+ int e = me.e(&ip, &kp);
+ int f = me.f(ifn, kfn);
+ int g = me.g(ifn, kfn);
+}
+
+template<template<typename> ...Foo, // expected-error {{template template parameter requires 'class' after the parameter list}}
+ template<template<template<typename>>>> // expected-error 3 {{template template parameter requires 'class' after the parameter list}}
+void func();
+
+template<int *ip> struct IP { }; // expected-note{{declared here}}
+IP<0> ip0; // expected-error{{null non-type template argument must be cast to template parameter type 'int *'}}
+
OpenPOWER on IntegriCloud