aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/dcl.dcl/dcl.spec/dcl.constexpr')
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp4
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp32
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp12
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp16
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp4
6 files changed, 35 insertions, 35 deletions
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
index 08fefdc91fb5..35dbec93e5bb 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
@@ -71,7 +71,7 @@ struct ConstexprDtor {
template <typename T> constexpr T ft(T t) { return t; }
template <typename T> T gt(T t) { return t; }
struct S {
- template<typename T> constexpr T f(); // expected-warning {{C++1y}}
+ template<typename T> constexpr T f(); // expected-warning {{C++14}}
template <typename T>
T g() const; // expected-note-re {{candidate template ignored: could not match 'T (){{( __attribute__\(\(thiscall\)\))?}} const' against 'char (){{( __attribute__\(\(thiscall\)\))?}}'}}
};
@@ -82,7 +82,7 @@ template <> char ft(char c) { return c; } // expected-note {{previous}}
template <> constexpr char ft(char nl); // expected-error {{constexpr declaration of 'ft<char>' follows non-constexpr declaration}}
template <> constexpr int gt(int nl) { return nl; }
template <> notlit S::f() const { return notlit(); }
-template <> constexpr int S::g() { return 0; } // expected-note {{previous}} expected-warning {{C++1y}}
+template <> constexpr int S::g() { return 0; } // expected-note {{previous}} expected-warning {{C++14}}
template <> int S::g() const; // expected-error {{non-constexpr declaration of 'g<int>' follows constexpr declaration}}
// specializations can drop the 'constexpr' but not the implied 'const'.
template <> char S::g() { return 0; } // expected-error {{no function template matches}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
index 780a420959d6..1e3734e54311 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
@@ -21,15 +21,15 @@ struct Literal {
struct S {
virtual int ImplicitlyVirtual() const = 0; // expected-note {{overridden virtual function}}
};
-struct SS : S {
+struct SS : S {
int ImplicitlyVirtual() const;
};
// The definition of a constexpr function shall satisfy the following
// constraints:
-struct T : SS, NonLiteral { // expected-note {{base class 'NonLiteral' of non-literal type}}
+struct T : SS, NonLiteral {
constexpr T();
- constexpr int f() const; // expected-error {{non-literal type 'T' cannot have constexpr members}}
+ constexpr int f() const;
// - it shall not be virtual;
virtual constexpr int ExplicitlyVirtual() const { return 0; } // expected-error {{virtual function cannot be constexpr}}
@@ -62,7 +62,7 @@ struct T : SS, NonLiteral { // expected-note {{base class 'NonLiteral' of non-li
constexpr T &operator=(const T&) = default;
#ifndef CXX1Y
// expected-error@-2 {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}
- // expected-warning@-3 {{C++1y}}
+ // expected-warning@-3 {{C++14}}
#else
// expected-error@-5 {{defaulted definition of copy assignment operator is not constexpr}}
#endif
@@ -161,21 +161,21 @@ constexpr int ForStmt() {
constexpr int VarDecl() {
int a = 0;
#ifndef CXX1Y
- // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{variable declaration in a constexpr function is a C++14 extension}}
#endif
return 0;
}
constexpr int ConstexprVarDecl() {
constexpr int a = 0;
#ifndef CXX1Y
- // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{variable declaration in a constexpr function is a C++14 extension}}
#endif
return 0;
}
constexpr int VarWithCtorDecl() {
Literal a;
#ifndef CXX1Y
- // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{variable declaration in a constexpr function is a C++14 extension}}
#endif
return 0;
}
@@ -183,7 +183,7 @@ NonLiteral nl;
constexpr NonLiteral &ExternNonLiteralVarDecl() {
extern NonLiteral nl;
#ifndef CXX1Y
- // expected-error@-2 {{variable declaration in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{variable declaration in a constexpr function is a C++14 extension}}
#endif
return nl;
}
@@ -191,28 +191,28 @@ static_assert(&ExternNonLiteralVarDecl() == &nl, "");
constexpr int FuncDecl() {
constexpr int ForwardDecl(int);
#ifndef CXX1Y
- // expected-error@-2 {{use of this statement in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{use of this statement in a constexpr function is a C++14 extension}}
#endif
return ForwardDecl(42);
}
constexpr int ClassDecl1() {
typedef struct { } S1;
#ifndef CXX1Y
- // expected-error@-2 {{type definition in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{type definition in a constexpr function is a C++14 extension}}
#endif
return 0;
}
constexpr int ClassDecl2() {
using S2 = struct { };
#ifndef CXX1Y
- // expected-error@-2 {{type definition in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{type definition in a constexpr function is a C++14 extension}}
#endif
return 0;
}
constexpr int ClassDecl3() {
struct S3 { };
#ifndef CXX1Y
- // expected-error@-2 {{type definition in a constexpr function is a C++1y extension}}
+ // expected-error@-2 {{type definition in a constexpr function is a C++14 extension}}
#endif
return 0;
}
@@ -245,11 +245,11 @@ namespace DR1364 {
namespace rdar13584715 {
typedef __PTRDIFF_TYPE__ ptrdiff_t;
-
+
template<typename T> struct X {
static T value() {};
};
-
+
void foo(ptrdiff_t id) {
switch (id) {
case reinterpret_cast<ptrdiff_t>(&X<long>::value): // expected-error{{case value is not a constant expression}} \
@@ -269,7 +269,7 @@ namespace std_example {
constexpr int abs(int x) {
if (x < 0)
#ifndef CXX1Y
- // expected-error@-2 {{C++1y}}
+ // expected-error@-2 {{C++14}}
#endif
x = -x;
return x;
@@ -295,7 +295,7 @@ namespace std_example {
return r;
}
#ifndef CXX1Y
- // expected-error@-5 {{C++1y}}
+ // expected-error@-5 {{C++14}}
// expected-error@-5 {{statement not allowed}}
#endif
}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp
index 708c259d5b61..9c1cab54b617 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp
@@ -92,37 +92,37 @@ struct V {
constexpr V(int(&)[2]) {
constexpr int a = 0;
#ifndef CXX1Y
- // expected-error@-2 {{variable declaration in a constexpr constructor is a C++1y extension}}
+ // expected-error@-2 {{variable declaration in a constexpr constructor is a C++14 extension}}
#endif
}
constexpr V(int(&)[3]) {
constexpr int ForwardDecl(int);
#ifndef CXX1Y
- // expected-error@-2 {{use of this statement in a constexpr constructor is a C++1y extension}}
+ // expected-error@-2 {{use of this statement in a constexpr constructor is a C++14 extension}}
#endif
}
constexpr V(int(&)[4]) {
typedef struct { } S1;
#ifndef CXX1Y
- // expected-error@-2 {{type definition in a constexpr constructor is a C++1y extension}}
+ // expected-error@-2 {{type definition in a constexpr constructor is a C++14 extension}}
#endif
}
constexpr V(int(&)[5]) {
using S2 = struct { };
#ifndef CXX1Y
- // expected-error@-2 {{type definition in a constexpr constructor is a C++1y extension}}
+ // expected-error@-2 {{type definition in a constexpr constructor is a C++14 extension}}
#endif
}
constexpr V(int(&)[6]) {
struct S3 { };
#ifndef CXX1Y
- // expected-error@-2 {{type definition in a constexpr constructor is a C++1y extension}}
+ // expected-error@-2 {{type definition in a constexpr constructor is a C++14 extension}}
#endif
}
constexpr V(int(&)[7]) {
return;
#ifndef CXX1Y
- // expected-error@-2 {{use of this statement in a constexpr constructor is a C++1y extension}}
+ // expected-error@-2 {{use of this statement in a constexpr constructor is a C++14 extension}}
#endif
}
};
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp
index 5e40f69d77ba..48973237ea0b 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp
@@ -102,7 +102,7 @@ X x = cmin(X(), X()); // ok, not constexpr
template<typename T>
struct Y {
constexpr Y() {}
- constexpr int get() { return T(); } // expected-warning {{C++1y}}
+ constexpr int get() { return T(); } // expected-warning {{C++14}}
};
struct Z { operator int(); };
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
index 40aa600ba1f7..428fd50b270f 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
@@ -3,13 +3,13 @@
using size_t = decltype(sizeof(int));
struct S {
- constexpr int f(); // expected-warning {{C++1y}}
+ constexpr int f(); // expected-warning {{C++14}}
constexpr int g() const;
- constexpr int h(); // expected-warning {{C++1y}}
+ constexpr int h(); // expected-warning {{C++14}}
int h();
static constexpr int Sf();
/*static*/ constexpr void *operator new(size_t) noexcept;
- template<typename T> constexpr T tm(); // expected-warning {{C++1y}}
+ template<typename T> constexpr T tm(); // expected-warning {{C++14}}
template<typename T> static constexpr T ts();
};
@@ -26,20 +26,20 @@ void f(const S &s) {
}
constexpr int S::f() const { return 0; }
-constexpr int S::g() { return 1; } // expected-warning {{C++1y}}
-constexpr int S::h() { return 0; } // expected-warning {{C++1y}}
+constexpr int S::g() { return 1; } // expected-warning {{C++14}}
+constexpr int S::h() { return 0; } // expected-warning {{C++14}}
int S::h() { return 0; }
constexpr int S::Sf() { return 2; }
constexpr void *S::operator new(size_t) noexcept { return 0; }
-template<typename T> constexpr T S::tm() { return T(); } // expected-warning {{C++1y}}
+template<typename T> constexpr T S::tm() { return T(); } // expected-warning {{C++14}}
template<typename T> constexpr T S::ts() { return T(); }
namespace std_example {
- class debug_flag { // expected-note {{not an aggregate and has no constexpr constructors}}
+ class debug_flag {
public:
explicit debug_flag(bool);
- constexpr bool is_on() const; // expected-error {{non-literal type 'std_example::debug_flag' cannot have constexpr members}}
+ constexpr bool is_on() const; // ok (dr1684)
private:
bool flag;
};
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp
index 2412a145f866..5f102e7458ea 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp
@@ -17,7 +17,7 @@ extern int (*const d)(int);
// A variable declaration which uses the constexpr specifier shall have an
// initializer and shall be initialized by a constant expression.
-constexpr int ni1; // expected-error {{default initialization of an object of const type 'const int'}}
+constexpr int ni1; // expected-error {{default initialization of an object of const type 'const int'}} expected-note {{add an explicit initializer to initialize 'ni1'}}
constexpr struct C { C(); } ni2; // expected-error {{cannot have non-literal type 'const struct C'}} expected-note 3{{has no constexpr constructors}}
constexpr double &ni3; // expected-error {{declaration of reference variable 'ni3' requires an initializer}}
@@ -34,4 +34,4 @@ struct pixel {
int x, y;
};
constexpr pixel ur = { 1294, 1024 }; // ok
-constexpr pixel origin; // expected-error {{default initialization of an object of const type 'const pixel' requires a user-provided default constructor}}
+constexpr pixel origin; // expected-error {{default initialization of an object of const type 'const pixel' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'origin'}}