aboutsummaryrefslogtreecommitdiff
path: root/test/CXX/dcl.dcl
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/dcl.dcl')
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp5
-rw-r--r--test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp3
-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
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp2
9 files changed, 42 insertions, 38 deletions
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
index 4f89dcfb3f52..ebe5388d65ac 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p8-cxx0x.cpp
@@ -17,6 +17,11 @@ void f() {
using X::s; // expected-error{{using declaration cannot refer to class member}}
}
+template <typename T>
+struct PR21933 : T {
+ static void StaticFun() { using T::member; } // expected-error{{using declaration cannot refer to class member}}
+};
+
struct S {
static int n;
struct Q {};
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
index 3bbbf9eed6e4..a27cea84db45 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.attr.deprecated/p1.cpp
@@ -21,8 +21,7 @@ e my_enum; // expected-warning {{'e' is deprecated}}
template <typename T> class X {};
template <> class [[deprecated]] X<int> {}; // expected-note {{'X<int>' has been explicitly marked deprecated here}}
X<char> x1;
-// FIXME: The diagnostic here could be much better by mentioning X<int>.
-X<int> x2; // expected-warning {{'X' is deprecated}}
+X<int> x2; // expected-warning {{'X<int>' is deprecated}}
template <typename T> class [[deprecated]] X2 {};
template <> class X2<int> {};
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'}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
index cc44f74a5547..865abb081a44 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp
@@ -44,7 +44,7 @@ namespace VariableLengthArrays {
void f() {
int n = 42;
- goto foo; // expected-error {{goto into protected scope}}
+ goto foo; // expected-error {{cannot jump}}
using T = int[n]; // expected-note {{bypasses initialization of VLA type alias}}
foo: ;
}