summaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/basic/basic.types/p10.cpp11
-rw-r--r--test/CXX/class.access/class.friend/p11.cpp10
-rw-r--r--test/CXX/class/class.mem/p2.cpp30
-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
-rw-r--r--test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.general/p8.cpp18
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp15
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/p6.cpp6
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp31
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp3
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/p1.cpp4
-rw-r--r--test/CXX/drs/dr0xx.cpp40
-rw-r--r--test/CXX/drs/dr10xx.cpp21
-rw-r--r--test/CXX/drs/dr13xx.cpp3
-rw-r--r--test/CXX/drs/dr14xx.cpp3
-rw-r--r--test/CXX/drs/dr15xx.cpp7
-rw-r--r--test/CXX/drs/dr16xx.cpp19
-rw-r--r--test/CXX/drs/dr18xx.cpp24
-rw-r--r--test/CXX/drs/dr1xx.cpp7
-rw-r--r--test/CXX/drs/dr2xx.cpp46
-rw-r--r--test/CXX/drs/dr3xx.cpp40
-rw-r--r--test/CXX/drs/dr412.cpp3
-rw-r--r--test/CXX/drs/dr4xx.cpp19
-rw-r--r--test/CXX/drs/dr5xx.cpp785
-rw-r--r--test/CXX/drs/dr6xx.cpp349
-rw-r--r--test/CXX/drs/dr9xx.cpp3
-rw-r--r--test/CXX/except/except.spec/p1.cpp9
-rw-r--r--test/CXX/except/except.spec/p5-delayed.cpp15
-rw-r--r--test/CXX/expr/expr.const/p2-0x.cpp8
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp5
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp4
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp2
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp2
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp7
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp7
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp4
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp2
-rw-r--r--test/CXX/lex/lex.literal/lex.ext/p3.cpp2
-rw-r--r--test/CXX/lex/lex.trigraph/p1.cpp2
-rw-r--r--test/CXX/lex/lex.trigraph/p2.cpp2
-rw-r--r--test/CXX/lex/lex.trigraph/p3.cpp2
-rw-r--r--test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp4
-rw-r--r--test/CXX/stmt.stmt/stmt.dcl/p3.cpp4
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp8
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p5.cpp8
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p5.cpp15
-rw-r--r--test/CXX/temp/temp.param/p5.cpp8
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp2
58 files changed, 1546 insertions, 161 deletions
diff --git a/test/CXX/basic/basic.types/p10.cpp b/test/CXX/basic/basic.types/p10.cpp
index 9d99a777449b2..7b1af00b5d5c7 100644
--- a/test/CXX/basic/basic.types/p10.cpp
+++ b/test/CXX/basic/basic.types/p10.cpp
@@ -38,15 +38,14 @@ constexpr ClassTemp<int> classtemplate2[] = {};
// - it has a trivial destructor
struct UserProvDtor {
- constexpr int f() const; // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}}
~UserProvDtor(); // expected-note {{has a user-provided destructor}}
};
-
+constexpr int f(UserProvDtor) { return 0; } // expected-error {{'UserProvDtor' is not a literal type}}
struct NonTrivDtor {
constexpr NonTrivDtor();
- constexpr int f() const; // expected-error {{non-literal type 'NonTrivDtor' cannot have constexpr members}}
virtual ~NonTrivDtor() = default; // expected-note {{has a non-trivial destructor}} expected-note {{because it is virtual}}
};
+constexpr int f(NonTrivDtor) { return 0; } // expected-error {{'NonTrivDtor' is not a literal type}}
struct NonTrivDtorBase {
~NonTrivDtorBase();
};
@@ -77,12 +76,12 @@ struct CtorTemplate {
};
struct CopyCtorOnly { // expected-note {{'CopyCtorOnly' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors}}
constexpr CopyCtorOnly(CopyCtorOnly&);
- constexpr int f() const; // expected-error {{non-literal type 'CopyCtorOnly' cannot have constexpr members}}
};
+constexpr int f(CopyCtorOnly) { return 0; } // expected-error {{'CopyCtorOnly' is not a literal type}}
struct MoveCtorOnly { // expected-note {{no constexpr constructors other than copy or move constructors}}
constexpr MoveCtorOnly(MoveCtorOnly&&);
- constexpr int f() const; // expected-error {{non-literal type 'MoveCtorOnly' cannot have constexpr members}}
};
+constexpr int f(MoveCtorOnly) { return 0; } // expected-error {{'MoveCtorOnly' is not a literal type}}
template<typename T>
struct CtorArg {
constexpr CtorArg(T);
@@ -110,8 +109,8 @@ constexpr int f(NonLitMember) {} // expected-error {{1st parameter type 'NonLitM
struct NonLitBase :
S { // expected-note {{base class 'S' of non-literal type}}
constexpr NonLitBase();
- constexpr int f() const { return 0; } // expected-error {{non-literal type 'NonLitBase' cannot have constexpr members}}
};
+constexpr int f(NonLitBase) { return 0; } // expected-error {{'NonLitBase' is not a literal type}}
struct LitMemBase : Agg {
Agg agg;
};
diff --git a/test/CXX/class.access/class.friend/p11.cpp b/test/CXX/class.access/class.friend/p11.cpp
index ba44a0d492452..a5107fd207288 100644
--- a/test/CXX/class.access/class.friend/p11.cpp
+++ b/test/CXX/class.access/class.friend/p11.cpp
@@ -24,6 +24,8 @@ namespace test2 {
void foo() { // expected-note {{'::test2::foo' declared here}}
struct S1 {
friend void foo(); // expected-error {{no matching function 'foo' found in local scope; did you mean '::test2::foo'?}}
+ // expected-note@-1{{'::test2::foo' declared here}}
+ // TODO: the above note should go on line 24
};
void foo(); // expected-note {{local declaration nearly matches}}
@@ -40,17 +42,19 @@ namespace test2 {
{
int foo;
struct S3 {
- friend void foo(); // expected-error {{no matching function found in local scope}}
+ friend void foo(); // expected-error {{no matching function 'foo' found in local scope; did you mean '::test2::foo'?}}
};
}
struct S4 {
friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
+ // expected-note@-1 2 {{'::test2::bar' declared here}}
+ // TODO: the above two notes should go on line 22
};
{ void bar(); }
struct S5 {
- friend void bar(); // expected-error {{no matching function found in local scope}}
+ friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
};
{
@@ -85,7 +89,7 @@ namespace test2 {
void quux() {}
void foo() {
struct Inner1 {
- friend void bar(); // expected-error {{no matching function found in local scope}}
+ friend void bar(); // expected-error {{no matching function 'bar' found in local scope; did you mean '::test2::bar'?}}
friend void quux(); // expected-error {{no matching function found in local scope}}
};
diff --git a/test/CXX/class/class.mem/p2.cpp b/test/CXX/class/class.mem/p2.cpp
index 4aa4a5c6f1b7b..d45c038606541 100644
--- a/test/CXX/class/class.mem/p2.cpp
+++ b/test/CXX/class/class.mem/p2.cpp
@@ -56,3 +56,33 @@ namespace test3 {
template struct A2<int>;
}
+
+namespace PR12629 {
+ struct S {
+ static int (f)() throw();
+ static int ((((((g))))() throw(U)));
+ int (*h)() noexcept(false);
+ static int (&i)() noexcept(true);
+ static int (*j)() throw(U); // expected-error {{unknown type name 'U'}}
+ static int (k)() throw(U);
+
+ struct U {};
+ };
+ static_assert(noexcept(S::f()), "");
+ static_assert(!noexcept(S::g()), "");
+ static_assert(!noexcept(S().h()), "");
+ static_assert(noexcept(S::i()), "");
+}
+
+namespace PR12688 {
+ struct S {
+ // FIXME: Producing one error saying this can't have the same name
+ // as the class because it's not a constructor, then producing
+ // another error saying this can't have a return type because
+ // it is a constructor, is redundant and inconsistent.
+ nonsense S() throw (more_nonsense); // \
+ // expected-error {{'nonsense'}} \
+ // expected-error {{has the same name as its class}} \
+ // expected-error {{constructor cannot have a return type}}
+ };
+}
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 4f89dcfb3f522..ebe5388d65acc 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 3bbbf9eed6e4f..a27cea84db456 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 08fefdc91fb5b..35dbec93e5bb3 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 780a420959d6b..1e3734e543119 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 708c259d5b612..9c1cab54b6179 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 5e40f69d77ba2..48973237ea0b1 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 40aa600ba1f78..428fd50b270fa 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 2412a145f866c..5f102e7458ea8 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 cc44f74a5547e..865abb081a44e 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: ;
}
diff --git a/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
index b9a1bc52886c3..81876192caa78 100644
--- a/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
+++ b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp
@@ -36,7 +36,7 @@ struct S3 {
constexpr S3 s3a = S3(0);
constexpr S3 s3b = s3a;
constexpr S3 s3c = S3();
-constexpr S3 s3d; // expected-error {{default initialization of an object of const type 'const S3' requires a user-provided default constructor}}
+constexpr S3 s3d; // expected-error {{default initialization of an object of const type 'const S3' without a user-provided default constructor}} expected-note{{add an explicit initializer to initialize 's3d'}}
struct S4 {
S4() = default;
@@ -119,6 +119,6 @@ namespace PR13492 {
};
void f() {
- const B b; // expected-error {{default initialization of an object of const type 'const PR13492::B' requires a user-provided default constructor}}
+ const B b; // expected-error {{default initialization of an object of const type 'const PR13492::B' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'b'}}
}
}
diff --git a/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.general/p8.cpp b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.general/p8.cpp
new file mode 100644
index 0000000000000..ff5d3dec30832
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.general/p8.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -std=c++11 %s -verify
+// expected-no-diagnostics
+
+using size_t = decltype(sizeof(0));
+template<typename T> struct check;
+template<size_t N> struct check<const char[N]> {};
+
+constexpr bool startswith(const char *p, const char *q) {
+ return !*q || (*p == *q && startswith(p + 1, q + 1));
+}
+constexpr bool contains(const char *p, const char *q) {
+ return *p && (startswith(p, q) || contains(p + 1, q));
+}
+
+void foo() {
+ check<decltype(__func__)>();
+ static_assert(contains(__func__, "foo"), "");
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp
index 971e0c11aff14..d7ffd0758a68a 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p3-0x.cpp
@@ -4,7 +4,7 @@ namespace std {
typedef decltype(sizeof(int)) size_t;
template <typename E>
- struct initializer_list // expected-note 2{{candidate}}
+ struct initializer_list
{
const E *p;
size_t n;
@@ -112,15 +112,16 @@ namespace bullet8 {
}
namespace rdar13395022 {
- struct MoveOnly {
- MoveOnly(MoveOnly&&);
+ struct MoveOnly { // expected-note {{candidate}}
+ MoveOnly(MoveOnly&&); // expected-note 2{{copy constructor is implicitly deleted because}} expected-note {{candidate}}
};
void test(MoveOnly mo) {
- // FIXME: These diagnostics are poor.
- auto &&list1 = {mo}; // expected-error{{no viable conversion}}
- MoveOnly (&&list2)[1] = {mo}; // expected-error{{no viable conversion}}
+ auto &&list1 = {mo}; // expected-error {{call to implicitly-deleted copy constructor}} expected-note {{in initialization of temporary of type 'std::initializer_list}}
+ MoveOnly (&&list2)[1] = {mo}; // expected-error {{call to implicitly-deleted copy constructor}} expected-note {{in initialization of temporary of type 'rdar13395022::MoveOnly [1]'}}
std::initializer_list<MoveOnly> &&list3 = {};
- MoveOnly (&&list4)[1] = {}; // expected-error{{uninitialized}}
+ MoveOnly (&&list4)[1] = {}; // expected-error {{no matching constructor}}
+ // expected-note@-1 {{in implicit initialization of array element 0 with omitted initializer}}
+ // expected-note@-2 {{in initialization of temporary of type 'rdar13395022::MoveOnly [1]' created to list-initialize this reference}}
}
}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
index 4ba75efebbb36..f86b24e992590 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx03-extra-copy.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -Wbind-to-temporary-copy -verify %s
// C++03 requires that we check for a copy constructor when binding a
// reference to a temporary, since we are allowed to make a copy, Even
diff --git a/test/CXX/dcl.decl/dcl.init/p6.cpp b/test/CXX/dcl.decl/dcl.init/p6.cpp
index 514fd0c9b6203..76b7e7625d571 100644
--- a/test/CXX/dcl.decl/dcl.init/p6.cpp
+++ b/test/CXX/dcl.decl/dcl.init/p6.cpp
@@ -10,15 +10,15 @@ struct NoUserDefault : public MakeNonPOD { };
struct HasUserDefault { HasUserDefault(); };
void test_const_default_init() {
- const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'const NoUserDefault' requires a user-provided default constructor}}
+ const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'const NoUserDefault' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'x1'}}
const HasUserDefault x2;
- const int x3; // expected-error{{default initialization of an object of const type 'const int'}}
+ const int x3; // expected-error{{default initialization of an object of const type 'const int'}} expected-note{{add an explicit initializer to initialize 'x3'}}
}
// rdar://8501008
struct s0 {};
struct s1 { static const s0 foo; };
-const struct s0 s1::foo; // expected-error{{default initialization of an object of const type 'const struct s0' requires a user-provided default constructor}}
+const struct s0 s1::foo; // expected-error{{default initialization of an object of const type 'const struct s0' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'foo'}}
template<typename T>
struct s2 {
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
index 19a5f23e3f17c..de1c5a708db68 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
@@ -46,3 +46,34 @@ struct X2 {
template<typename T>
void f4(T ...args); // expected-error{{type 'T' of function parameter pack does not contain any unexpanded parameter packs}}
+void f4i(int ... x); // expected-error{{type 'int' of function parameter pack does not contain any unexpanded parameter packs}}
+void f4i0(int ...);
+
+namespace array_type {
+template<typename T>
+void a(T[] ... x); // expected-error{{expected ')'}} expected-note{{to match this '('}}
+
+template<typename T>
+void b(T[] ...);
+
+template<typename T>
+void c(T ... []); // expected-error{{type 'T []' of function parameter pack does not contain any unexpanded parameter packs}}
+
+template<typename T>
+void d(T ... x[]); // expected-error{{type 'T []' of function parameter pack does not contain any unexpanded parameter packs}}
+
+void ai(int[] ... x); // expected-error{{expected ')'}} expected-note{{to match this '('}}
+void bi(int[] ...);
+void ci(int ... []); // expected-error{{type 'int []' of function parameter pack does not contain any unexpanded parameter packs}}
+void di(int ... x[]); // expected-error{{type 'int []' of function parameter pack does not contain any unexpanded parameter packs}}
+}
+
+void f5a(auto fp(int)->unk ...) {} // expected-error{{unknown type name 'unk'}}
+void f5b(auto fp(int)->auto ...) {} // expected-error{{'auto' not allowed in function return type}}
+void f5c(auto fp()->...) {} // expected-error{{expected a type}}
+
+// FIXME: Expand for function and member pointer types.
+
+
+
+
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
index bc249b5a087b3..ac9344dea1c18 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
@@ -1,5 +1,4 @@
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
-// expected-no-diagnostics
template<typename T> struct identity;
template<typename ...Types> struct tuple;
@@ -22,7 +21,7 @@ template<typename T> struct is_same<T, T> {
template<typename T, typename ...Types>
struct X0 {
typedef identity<T(Types...)> function_pack_1;
- typedef identity<T(Types......)> variadic_function_pack_1;
+ typedef identity<T(Types......)> variadic_function_pack_1; // expected-warning {{varargs}} expected-note {{pack}} expected-note {{insert ','}}
typedef identity<T(T...)> variadic_1;
typedef tuple<T(Types, ...)...> template_arg_expansion_1;
};
diff --git a/test/CXX/dcl.decl/dcl.meaning/p1.cpp b/test/CXX/dcl.decl/dcl.meaning/p1.cpp
index 5747380f2806d..cefee7b8dc41e 100644
--- a/test/CXX/dcl.decl/dcl.meaning/p1.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/p1.cpp
@@ -27,6 +27,7 @@ namespace NS {
struct X;
template<typename T> struct Y;
template<typename T> void wibble(T);
+ struct Z;
}
namespace NS {
// Under DR482, these are all valid, except for forward-declaring a struct
@@ -43,3 +44,6 @@ namespace NS {
template<typename T> struct NS::Y { }; // expected-warning{{extra qualification on member 'Y'}}
template<typename T> void NS::wibble(T) { } // expected-warning{{extra qualification on member 'wibble'}}
}
+
+struct ::{} a; // expected-error{{expected identifier}}
+struct NS::Z:: {} b; // expected-error{{expected identifier}}
diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp
index 29e1720b1bbf0..5b34cc3380c11 100644
--- a/test/CXX/drs/dr0xx.cpp
+++ b/test/CXX/drs/dr0xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -Wno-bind-to-temporary-copy
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace dr1 { // dr1: no
namespace X { extern "C" void dr1_f(int a = 1); }
@@ -520,17 +521,28 @@ namespace dr48 { // dr48: yes
}
namespace dr49 { // dr49: yes
- template<int*> struct A {}; // expected-note {{here}}
+ template<int*> struct A {}; // expected-note 0-2{{here}}
int k;
#if __has_feature(cxx_constexpr)
constexpr
#endif
- int *const p = &k;
+ int *const p = &k; // expected-note 0-2{{here}}
A<&k> a;
- A<p> b; // expected-error {{must have its address taken}}
+ A<p> b;
+#if __cplusplus <= 201402L
+ // expected-error@-2 {{must have its address taken}}
+#endif
+#if __cplusplus < 201103L
+ // expected-error@-5 {{internal linkage}}
+#endif
+ int *q = &k;
+ A<q> c;
#if __cplusplus < 201103L
- // expected-error@-2 {{internal linkage}}
- // expected-note@-5 {{here}}
+ // expected-error@-2 {{must have its address taken}}
+#else
+ // expected-error@-4 {{constant expression}}
+ // expected-note@-5 {{read of non-constexpr}}
+ // expected-note@-7 {{declared here}}
#endif
}
@@ -822,7 +834,7 @@ namespace dr70 { // dr70: yes
namespace dr73 { // dr73: no
// The resolution to dr73 is unworkable. Consider:
int a, b;
- static_assert(&a + 1 != &b, "");
+ static_assert(&a + 1 != &b, ""); // expected-error {{not an integral constant expression}}
}
#endif
@@ -852,7 +864,7 @@ namespace dr77 { // dr77: yes
namespace dr78 { // dr78: sup ????
// Under DR78, this is valid, because 'k' has static storage duration, so is
// zero-initialized.
- const int k; // expected-error {{default initialization of an object of const}}
+ const int k; // expected-error {{default initialization of an object of const}} expected-note{{add an explicit initializer to initialize 'k'}}
}
// dr79: na
@@ -994,6 +1006,10 @@ namespace dr92 { // dr92: yes
g(q); // expected-error {{is not superset}}
}
+ // Prior to C++17, this is OK because the exception specification is not
+ // considered in this context. In C++17, we *do* perform an implicit
+ // conversion (which performs initialization), but we convert to the type of
+ // the template parameter, which does not include the exception specification.
template<void() throw()> struct X {};
X<&f> xp; // ok
}
@@ -1051,18 +1067,18 @@ namespace dr98 { // dr98: yes
void test(int n) {
switch (n) {
try { // expected-note 2{{bypasses}}
- case 0: // expected-error {{protected}}
+ case 0: // expected-error {{cannot jump}}
x:
throw n;
} catch (...) { // expected-note 2{{bypasses}}
- case 1: // expected-error {{protected}}
+ case 1: // expected-error {{cannot jump}}
y:
throw n;
}
case 2:
- goto x; // expected-error {{protected}}
+ goto x; // expected-error {{cannot jump}}
case 3:
- goto y; // expected-error {{protected}}
+ goto y; // expected-error {{cannot jump}}
}
}
}
diff --git a/test/CXX/drs/dr10xx.cpp b/test/CXX/drs/dr10xx.cpp
index 64c71b2b0f92f..a1d7ef67c66d9 100644
--- a/test/CXX/drs/dr10xx.cpp
+++ b/test/CXX/drs/dr10xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// expected-no-diagnostics
@@ -13,6 +14,24 @@ namespace std {
};
}
+namespace dr1048 { // dr1048: 3.6
+ struct A {};
+ const A f();
+ A g();
+ typedef const A CA;
+#if __cplusplus >= 201103L
+ // ok: we deduce non-const A in each case.
+ A &&a = [] (int n) {
+ while (1) switch (n) {
+ case 0: return f();
+ case 1: return g();
+ case 2: return A();
+ case 3: return CA();
+ }
+ } (0);
+#endif
+}
+
namespace dr1070 { // dr1070: 3.5
#if __cplusplus >= 201103L
struct A {
diff --git a/test/CXX/drs/dr13xx.cpp b/test/CXX/drs/dr13xx.cpp
index 5827291142dc6..29b39cbb95a1a 100644
--- a/test/CXX/drs/dr13xx.cpp
+++ b/test/CXX/drs/dr13xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace dr1346 { // dr1346: 3.5
auto a(1); // expected-error 0-1{{extension}}
diff --git a/test/CXX/drs/dr14xx.cpp b/test/CXX/drs/dr14xx.cpp
index 8de1b8d623a92..e931924272688 100644
--- a/test/CXX/drs/dr14xx.cpp
+++ b/test/CXX/drs/dr14xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
#if __cplusplus < 201103L
// expected-no-diagnostics
diff --git a/test/CXX/drs/dr15xx.cpp b/test/CXX/drs/dr15xx.cpp
index 66618c1716d62..d7c2b9225c4d7 100644
--- a/test/CXX/drs/dr15xx.cpp
+++ b/test/CXX/drs/dr15xx.cpp
@@ -1,16 +1,17 @@
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// expected-no-diagnostics
-namespace DR1550 { // dr1550: yes
+namespace dr1550 { // dr1550: yes
int f(bool b, int n) {
return (b ? (throw 0) : n) + (b ? n : (throw 0));
}
}
-namespace DR1560 { // dr1560: 3.5
+namespace dr1560 { // dr1560: 3.5
void f(bool b, int n) {
(b ? throw 0 : n) = (b ? n : throw 0) = 0;
}
diff --git a/test/CXX/drs/dr16xx.cpp b/test/CXX/drs/dr16xx.cpp
new file mode 100644
index 0000000000000..62040f1a130ad
--- /dev/null
+++ b/test/CXX/drs/dr16xx.cpp
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+
+#if __cplusplus < 201103L
+// expected-no-diagnostics
+#endif
+
+namespace dr1684 { // dr1684: 3.6
+#if __cplusplus >= 201103L
+ struct NonLiteral { // expected-note {{because}}
+ NonLiteral();
+ constexpr int f() { return 0; } // expected-warning 0-1{{will not be implicitly 'const'}}
+ };
+ constexpr int f(NonLiteral &) { return 0; }
+ constexpr int f(NonLiteral) { return 0; } // expected-error {{not a literal type}}
+#endif
+}
diff --git a/test/CXX/drs/dr18xx.cpp b/test/CXX/drs/dr18xx.cpp
new file mode 100644
index 0000000000000..bc72b67d1e0b7
--- /dev/null
+++ b/test/CXX/drs/dr18xx.cpp
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+
+#if __cplusplus < 201103L
+// expected-no-diagnostics
+#endif
+
+void dr1891() { // dr1891: 3.6
+#if __cplusplus >= 201103L
+ int n;
+ auto a = []{}; // expected-note 2{{candidate}}
+ auto b = [=]{ return n; }; // expected-note 2{{candidate}}
+ typedef decltype(a) A;
+ typedef decltype(b) B;
+
+ static_assert(!__has_trivial_constructor(A), "");
+ static_assert(!__has_trivial_constructor(B), "");
+
+ A x; // expected-error {{no matching constructor}}
+ B y; // expected-error {{no matching constructor}}
+#endif
+}
diff --git a/test/CXX/drs/dr1xx.cpp b/test/CXX/drs/dr1xx.cpp
index 6aff43c6a4885..cc6c5af817083 100644
--- a/test/CXX/drs/dr1xx.cpp
+++ b/test/CXX/drs/dr1xx.cpp
@@ -1,10 +1,11 @@
// RUN: %clang_cc1 -std=c++98 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z -triple x86_64-unknown-unknown %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace dr100 { // dr100: yes
- template<const char *> struct A {}; // expected-note {{declared here}}
- template<const char (&)[4]> struct B {}; // expected-note {{declared here}}
+ template<const char *> struct A {}; // expected-note 0-1{{declared here}}
+ template<const char (&)[4]> struct B {}; // expected-note 0-1{{declared here}}
A<"foo"> a; // expected-error {{does not refer to any declaration}}
B<"bar"> b; // expected-error {{does not refer to any declaration}}
}
diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp
index bb9af9fd9337e..bb1f13ac64ee7 100644
--- a/test/CXX/drs/dr2xx.cpp
+++ b/test/CXX/drs/dr2xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// PR13819 -- __SIZE_TYPE__ is incompatible.
typedef __SIZE_TYPE__ size_t; // expected-error 0-1 {{extension}}
@@ -195,8 +196,8 @@ namespace dr218 { // dr218: yes
// dr220: na
namespace dr221 { // dr221: yes
- struct A {
- A &operator=(int&);
+ struct A { // expected-note 2-4{{candidate}}
+ A &operator=(int&); // expected-note 2{{candidate}}
A &operator+=(int&);
static A &operator=(A&, double&); // expected-error {{cannot be a static member}}
static A &operator+=(A&, double&); // expected-error {{cannot be a static member}}
@@ -209,9 +210,9 @@ namespace dr221 { // dr221: yes
void test(A a, int n, char c, float f) {
a = n;
a += n;
- a = c;
+ a = c; // expected-error {{no viable}}
a += c;
- a = f;
+ a = f; // expected-error {{no viable}}
a += f;
}
}
@@ -466,7 +467,7 @@ namespace dr243 { // dr243: yes
A a2 = b; // expected-error {{ambiguous}}
}
-namespace dr244 { // dr244: 3.5
+namespace dr244 { // dr244: partial
struct B {}; struct D : B {}; // expected-note {{here}}
D D_object;
@@ -484,6 +485,28 @@ namespace dr244 { // dr244: 3.5
B_ptr->dr244::~B(); // expected-error {{refers to a member in namespace}}
B_ptr->dr244::~B_alias(); // expected-error {{refers to a member in namespace}}
}
+
+ namespace N {
+ template<typename T> struct E {};
+ typedef E<int> F;
+ }
+ void g(N::F f) {
+ typedef N::F G;
+ f.~G();
+ f.G::~E();
+ f.G::~F(); // expected-error {{expected the class name after '~' to name a destructor}}
+ f.G::~G();
+ // This is technically ill-formed; E is looked up in 'N::' and names the
+ // class template, not the injected-class-name of the class. But that's
+ // probably a bug in the standard.
+ f.N::F::~E();
+ // This is valid; we look up the second F in the same scope in which we
+ // found the first one, that is, 'N::'.
+ f.N::F::~F(); // FIXME: expected-error {{expected the class name after '~' to name a destructor}}
+ // This is technically ill-formed; G is looked up in 'N::' and is not found;
+ // as above, this is probably a bug in the standard.
+ f.N::F::~G();
+ }
}
namespace dr245 { // dr245: yes
@@ -499,7 +522,7 @@ namespace dr246 { // dr246: yes
throw 0;
X: ;
} catch (int) {
- goto X; // expected-error {{protected scope}}
+ goto X; // expected-error {{cannot jump}}
}
};
}
@@ -968,12 +991,11 @@ namespace dr289 { // dr289: yes
namespace dr294 { // dr294: no
void f() throw(int);
int main() {
- // FIXME: we reject this for the wrong reason, because we don't implement
- // dr87 yet.
- (void)static_cast<void (*)() throw()>(f); // expected-error {{not superset}}
- void (*p)() throw() = f; // expected-error {{not superset}}
-
+ (void)static_cast<void (*)() throw()>(f); // FIXME: ill-formed
(void)static_cast<void (*)() throw(int)>(f); // FIXME: ill-formed
+
+ void (*p)() throw() = f; // expected-error {{not superset}}
+ void (*q)() throw(int) = f;
}
}
diff --git a/test/CXX/drs/dr3xx.cpp b/test/CXX/drs/dr3xx.cpp
index 53fc20e23fe69..cea4d64e7eb6b 100644
--- a/test/CXX/drs/dr3xx.cpp
+++ b/test/CXX/drs/dr3xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
namespace dr300 { // dr300: yes
template<typename R, typename A> void f(R (&)(A)) {}
@@ -181,9 +182,15 @@ namespace dr308 { // dr308: yes
namespace dr311 { // dr311: yes
namespace X { namespace Y {} }
- namespace X::Y {} // expected-error {{must define each namespace separately}}
+ namespace X::Y {}
+#if __cplusplus <= 201402L
+ // expected-error@-2 {{define each namespace separately}}
+#endif
namespace X {
- namespace X::Y {} // expected-error {{must define each namespace separately}}
+ namespace X::Y {}
+#if __cplusplus <= 201402L
+ // expected-error@-2 {{define each namespace separately}}
+#endif
}
// FIXME: The diagnostics here are not very good.
namespace ::dr311::X {} // expected-error 2+{{}} // expected-warning {{extra qual}}
@@ -199,7 +206,7 @@ namespace dr313 { // dr313: dup 299 c++11
#endif
}
-namespace dr314 { // dr314: dup 1710
+namespace dr314 { // FIXME 314: dup 1710
template<typename T> struct A {
template<typename U> struct B {};
};
@@ -322,6 +329,7 @@ namespace dr324 { // dr324: yes
int *f = &(true ? s.n : s.n); // expected-error {{address of bit-field}}
int &g = (void(), s.n); // expected-error {{non-const reference cannot bind to bit-field}}
int *h = &(void(), s.n); // expected-error {{address of bit-field}}
+ int *i = &++s.n; // expected-error {{address of bit-field}}
}
namespace dr326 { // dr326: yes
@@ -365,7 +373,7 @@ namespace dr331 { // dr331: yes
} const a, b(a); // expected-error {{no matching constructor}}
}
-namespace dr332 { // dr332: dup 557
+namespace dr332 { // dr332: dup 577
void f(volatile void); // expected-error {{'void' as parameter must not have type qualifiers}}
void g(const void); // expected-error {{'void' as parameter must not have type qualifiers}}
void h(int n, volatile void); // expected-error {{'void' must be the first and only parameter}}
@@ -497,7 +505,7 @@ namespace dr341 {
// dr342: na
-namespace dr343 { // dr343: no
+namespace dr343 { // FIXME 343: no
// FIXME: dup 1710
template<typename T> struct A {
template<typename U> struct B {};
@@ -697,7 +705,7 @@ namespace dr354 { // dr354: yes c++11
// FIXME: Should we allow this in C++98 too?
struct S {};
- template<int*> struct ptr {}; // expected-note +{{here}}
+ template<int*> struct ptr {}; // expected-note 0-4{{here}}
ptr<0> p0;
ptr<(int*)0> p1;
ptr<(float*)0> p2;
@@ -707,11 +715,16 @@ namespace dr354 { // dr354: yes c++11
// expected-error@-5 {{does not refer to any decl}}
// expected-error@-5 {{does not refer to any decl}}
// expected-error@-5 {{does not refer to any decl}}
-#else
+#elif __cplusplus <= 201402L
// expected-error@-10 {{must be cast}}
// ok
// expected-error@-10 {{does not match}}
// expected-error@-10 {{does not match}}
+#else
+ // expected-error@-15 {{conversion from 'int' to 'int *' is not allowed}}
+ // ok
+ // expected-error@-15 {{'float *' is not implicitly convertible to 'int *'}}
+ // expected-error@-15 {{'int dr354::S::*' is not implicitly convertible to 'int *'}}
#endif
template<int*> int both();
@@ -724,7 +737,7 @@ namespace dr354 { // dr354: yes c++11
// expected-note@-6 {{candidate}}
#endif
- template<int S::*> struct ptr_mem {}; // expected-note +{{here}}
+ template<int S::*> struct ptr_mem {}; // expected-note 0-4{{here}}
ptr_mem<0> m0;
ptr_mem<(int S::*)0> m1;
ptr_mem<(float S::*)0> m2;
@@ -734,11 +747,16 @@ namespace dr354 { // dr354: yes c++11
// expected-error@-5 {{is not a pointer to member constant}}
// expected-error@-5 {{cannot be converted}}
// expected-error@-5 {{cannot be converted}}
-#else
+#elif __cplusplus <= 201402L
// expected-error@-10 {{must be cast}}
// ok
// expected-error@-10 {{does not match}}
// expected-error@-10 {{does not match}}
+#else
+ // expected-error@-15 {{conversion from 'int' to 'int dr354::S::*' is not allowed}}
+ // ok
+ // expected-error@-15 {{'float dr354::S::*' is not implicitly convertible to 'int dr354::S::*'}}
+ // expected-error@-15 {{'int *' is not implicitly convertible to 'int dr354::S::*'}}
#endif
}
@@ -1201,7 +1219,7 @@ namespace dr391 { // dr391: yes c++11
namespace dr395 { // dr395: yes
struct S {
- template <typename T, int N>(&operator T())[N]; // expected-error {{must use a typedef}}
+ template <typename T, int N>(&operator T())[N]; // expected-error {{cannot specify any part of a return type}}
template <typename T, int N> operator(T (&)[N])(); // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-error +{{}}
template <typename T> operator T *() const { return 0; }
template <typename T, typename U> operator T U::*() const { return 0; }
diff --git a/test/CXX/drs/dr412.cpp b/test/CXX/drs/dr412.cpp
index cb33e206a632f..39cdd6182d206 100644
--- a/test/CXX/drs/dr412.cpp
+++ b/test/CXX/drs/dr412.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT="throw()" -DBAD_ALLOC="throw(std::bad_alloc)"
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors -DNOEXCEPT=noexcept -DBAD_ALLOC=
// dr412: yes
// lwg404: yes
diff --git a/test/CXX/drs/dr4xx.cpp b/test/CXX/drs/dr4xx.cpp
index 815dbfc0b4010..42c6774dd1866 100644
--- a/test/CXX/drs/dr4xx.cpp
+++ b/test/CXX/drs/dr4xx.cpp
@@ -1,6 +1,7 @@
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: env ASAN_OPTIONS=detect_stack_use_after_return=0 %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
__extension__ typedef __SIZE_TYPE__ size_t;
@@ -501,15 +502,15 @@ namespace dr436 { // dr436: yes
void f(); // expected-error {{redefinition}}
}
-namespace dr437 { // dr437: no
+namespace dr437 { // dr437: sup 1308
// This is superseded by 1308, which is in turn superseded by 1330,
// which restores this rule.
- template<typename U> struct T : U {}; // expected-error {{incomplete}}
- struct S { // expected-note {{not complete}}
+ template<typename U> struct T : U {};
+ struct S {
void f() throw(S);
- void g() throw(T<S>); // expected-note {{in instantiation of}}
- struct U; // expected-note {{forward}}
- void h() throw(U); // expected-error {{incomplete}}
+ void g() throw(T<S>);
+ struct U;
+ void h() throw(U);
struct U {};
};
}
@@ -755,7 +756,7 @@ namespace dr467 { // dr467: yes
return k;
}
int g() {
- goto later; // expected-error {{protected scope}}
+ goto later; // expected-error {{cannot jump}}
int k = stuff(); // expected-note {{bypasses variable initialization}}
later:
return k;
@@ -1201,7 +1202,7 @@ namespace dr497 { // dr497: yes
struct S {
mutable int i;
};
- const S cs; // expected-error {{default initialization}}
+ const S cs; // expected-error {{default initialization}} expected-note {{add an explicit initializer}}
int S::*pm = &S::i;
cs.*pm = 88;
}
diff --git a/test/CXX/drs/dr5xx.cpp b/test/CXX/drs/dr5xx.cpp
index 0c0d451c4b222..5bf085f52204a 100644
--- a/test/CXX/drs/dr5xx.cpp
+++ b/test/CXX/drs/dr5xx.cpp
@@ -1,6 +1,13 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+
+// FIXME: This is included to avoid a diagnostic with no source location
+// pointing at the implicit operator new. We can't match such a diagnostic
+// with -verify.
+__extension__ typedef __SIZE_TYPE__ size_t;
+void *operator new(size_t); // expected-warning 0-1{{missing exception spec}} expected-note{{candidate}}
namespace dr500 { // dr500: dup 372
class D;
@@ -195,6 +202,153 @@ namespace dr525 { // dr525: yes
}
}
+namespace dr526 { // dr526: yes
+ template<int> struct S {};
+ template<int N> void f1(S<N> s);
+ template<int N> void f2(S<(N)> s); // expected-note {{couldn't infer}}
+ template<int N> void f3(S<+N> s); // expected-note {{couldn't infer}}
+ template<int N> void g1(int (&)[N]);
+ template<int N> void g2(int (&)[(N)]); // expected-note {{couldn't infer}}
+ template<int N> void g3(int (&)[+N]); // expected-note {{couldn't infer}}
+
+ void test(int (&a)[3], S<3> s) {
+ f1(s);
+ f2(s); // expected-error {{no matching}}
+ f3(s); // expected-error {{no matching}}
+ g1(a);
+ g2(a); // expected-error {{no matching}}
+ g3(a); // expected-error {{no matching}}
+ }
+
+ template<int N> struct X {
+ typedef int type;
+ X<N>::type v1;
+ X<(N)>::type v2; // expected-error {{missing 'typename'}}
+ X<+N>::type v3; // expected-error {{missing 'typename'}}
+ };
+}
+
+namespace dr527 { // dr527: na
+ // This DR is meaningless. It removes a required diagnostic from the case
+ // where a not-externally-visible object is odr-used but not defined, which
+ // requires a diagnostic for a different reason.
+ extern struct { int x; } a; // FIXME: We should reject this, per dr389.
+ static struct { int x; } b;
+ extern "C" struct { int x; } c;
+ namespace { extern struct { int x; } d; }
+ typedef struct { int x; } *P;
+ struct E { static P e; }; // FIXME: We should reject this, per dr389.
+ namespace { struct F { static P f; }; }
+
+ int ax = a.x, bx = b.x, cx = c.x, dx = d.x, ex = E::e->x, fx = F::f->x;
+}
+
+namespace dr530 { // dr530: yes
+ template<int*> struct S { enum { N = 1 }; };
+ template<void(*)()> struct T { enum { N = 1 }; };
+ int n;
+ void f();
+ int a[S<&n>::N];
+ int b[T<&f>::N];
+}
+
+namespace dr531 { // dr531: partial
+ namespace good {
+ template<typename T> struct A {
+ void f(T) { T::error; }
+ template<typename U> void g(T, U) { T::error; }
+ struct B { typename T::error error; };
+ template<typename U> struct C { typename T::error error; };
+ static T n;
+ };
+ template<typename T> T A<T>::n = T::error;
+
+ template<> void A<int>::f(int) {}
+ template<> template<typename U> void A<int>::g(int, U) {}
+ template<> struct A<int>::B {};
+ template<> template<typename U> struct A<int>::C {};
+ template<> int A<int>::n = 0;
+
+ void use(A<int> a) {
+ a.f(a.n);
+ a.g(0, 0);
+ A<int>::B b;
+ A<int>::C<int> c;
+ }
+
+ template<> struct A<char> {
+ void f(char);
+ template<typename U> void g(char, U);
+ struct B;
+ template<typename U> struct C;
+ static char n;
+ };
+
+ void A<char>::f(char) {}
+ template<typename U> void A<char>::g(char, U) {}
+ struct A<char>::B {};
+ template<typename U> struct A<char>::C {};
+ char A<char>::n = 0;
+ }
+
+ namespace bad {
+ template<typename T> struct A {
+ void f(T) { T::error; }
+ template<typename U> void g(T, U) { T::error; }
+ struct B { typename T::error error; };
+ template<typename U> struct C { typename T::error error; }; // expected-note {{here}}
+ static T n;
+ };
+ template<typename T> T A<T>::n = T::error;
+
+ void A<int>::f(int) {} // expected-error {{requires 'template<>'}}
+ template<typename U> void A<int>::g(int, U) {} // expected-error {{should be empty}}
+ struct A<int>::B {}; // expected-error {{requires 'template<>'}}
+ template<typename U> struct A<int>::C {}; // expected-error {{should be empty}} expected-error {{different kind of symbol}}
+ int A<int>::n = 0; // expected-error {{requires 'template<>'}}
+
+ template<> struct A<char> { // expected-note 2{{here}}
+ void f(char);
+ template<typename U> void g(char, U);
+ struct B; // expected-note {{here}}
+ template<typename U> struct C;
+ static char n;
+ };
+
+ template<> void A<char>::f(char) {} // expected-error {{no function template matches}}
+ // FIXME: This is ill-formed; -pedantic-errors should reject.
+ template<> template<typename U> void A<char>::g(char, U) {} // expected-warning {{extraneous template parameter list}}
+ template<> struct A<char>::B {}; // expected-error {{extraneous 'template<>'}} expected-error {{does not specialize}}
+ // FIXME: This is ill-formed; -pedantic-errors should reject.
+ template<> template<typename U> struct A<char>::C {}; // expected-warning {{extraneous template parameter list}}
+ template<> char A<char>::n = 0; // expected-error {{extraneous 'template<>'}}
+ }
+
+ namespace nested {
+ template<typename T> struct A {
+ template<typename U> struct B;
+ };
+ template<> template<typename U> struct A<int>::B {
+ void f();
+ void g();
+ template<typename V> void h();
+ template<typename V> void i();
+ };
+ template<> template<typename U> void A<int>::B<U>::f() {}
+ template<typename U> void A<int>::B<U>::g() {} // expected-error {{should be empty}}
+
+ template<> template<typename U> template<typename V> void A<int>::B<U>::h() {}
+ template<typename U> template<typename V> void A<int>::B<U>::i() {} // expected-error {{should be empty}}
+
+ template<> template<> void A<int>::B<int>::f() {}
+ template<> template<> template<typename V> void A<int>::B<int>::h() {}
+ template<> template<> template<> void A<int>::B<int>::h<int>() {}
+
+ template<> void A<int>::B<char>::f() {} // expected-error {{requires 'template<>'}}
+ template<> template<typename V> void A<int>::B<char>::h() {} // expected-error {{should be empty}}
+ }
+}
+
// PR8130
namespace dr532 { // dr532: 3.5
struct A { };
@@ -210,3 +364,632 @@ namespace dr532 { // dr532: 3.5
int &ir = b * a;
}
}
+
+// dr533: na
+
+namespace dr534 { // dr534: yes
+ struct S {};
+ template<typename T> void operator+(S, T);
+ template<typename T> void operator+<T*>(S, T*) {} // expected-error {{function template partial spec}}
+}
+
+namespace dr535 { // dr535: yes
+ class X { private: X(const X&); };
+ struct A {
+ X x;
+ template<typename T> A(T&);
+ };
+ struct B : A {
+ X y;
+ B(volatile A&);
+ };
+
+ extern A a1;
+ A a2(a1); // ok, uses constructor template
+
+ extern volatile B b1;
+ B b2(b1); // ok, uses converting constructor
+
+ void f() { throw a1; }
+
+#if __cplusplus >= 201103L
+ struct C {
+ constexpr C() : n(0) {}
+ template<typename T> constexpr C(T&t) : n(t.n == 0 ? throw 0 : 0) {}
+ int n;
+ };
+ constexpr C c() { return C(); }
+ // ok, copy is elided
+ constexpr C x = c();
+#endif
+}
+
+// dr537: na
+// dr538: na
+
+// dr539: yes
+const dr539( // expected-error {{requires a type specifier}}
+ const a) { // expected-error {{unknown type name 'a'}}
+ const b; // expected-error {{requires a type specifier}}
+ new const; // expected-error {{expected a type}}
+ try {} catch (const n) {} // expected-error {{unknown type name 'n'}}
+ try {} catch (const) {} // expected-error {{expected a type}}
+ if (const n = 0) {} // expected-error {{requires a type specifier}}
+ switch (const n = 0) {} // expected-error {{requires a type specifier}}
+ while (const n = 0) {} // expected-error {{requires a type specifier}}
+ for (const n = 0; // expected-error {{requires a type specifier}}
+ const m = 0; ) {} // expected-error {{requires a type specifier}}
+ sizeof(const); // expected-error {{requires a type specifier}}
+ struct S {
+ const n; // expected-error {{requires a type specifier}}
+ operator const(); // expected-error {{expected a type}}
+ };
+#if __cplusplus >= 201103L
+ int arr[3];
+ // FIXME: The extra braces here are to avoid the parser getting too
+ // badly confused when recovering here. We should fix this recovery.
+ { for (const n // expected-error {{unknown type name 'n'}} expected-note {{}}
+ : arr) ; {} } // expected-error +{{}}
+ (void) [](const) {}; // expected-error {{requires a type specifier}}
+ (void) [](const n) {}; // expected-error {{unknown type name 'n'}}
+ enum E : const {}; // expected-error {{expected a type}}
+ using T = const; // expected-error {{expected a type}}
+ auto f() -> const; // expected-error {{expected a type}}
+#endif
+}
+
+namespace dr540 { // dr540: yes
+ typedef int &a;
+ typedef const a &a; // expected-warning {{has no effect}}
+ typedef const int &b;
+ typedef b &b;
+ typedef const a &c; // expected-note {{previous}} expected-warning {{has no effect}}
+ typedef const b &c; // expected-error {{different}} expected-warning {{has no effect}}
+}
+
+namespace dr541 { // dr541: yes
+ template<int> struct X { typedef int type; };
+ template<typename T> struct S {
+ int f(T);
+
+ int g(int);
+ T g(bool);
+
+ int h();
+ int h(T);
+
+ void x() {
+ // These are type-dependent expressions, even though we could
+ // determine that all calls have type 'int'.
+ X<sizeof(f(0))>::type a; // expected-error +{{}}
+ X<sizeof(g(0))>::type b; // expected-error +{{}}
+ X<sizeof(h(0))>::type b; // expected-error +{{}}
+
+ typename X<sizeof(f(0))>::type a;
+ typename X<sizeof(h(0))>::type b;
+ }
+ };
+}
+
+namespace dr542 { // dr542: yes
+#if __cplusplus >= 201103L
+ struct A { A() = delete; int n; };
+ A a[32] = {}; // ok, constructor not called
+
+ struct B {
+ int n;
+ private:
+ B() = default;
+ };
+ B b[32] = {}; // ok, constructor not called
+#endif
+}
+
+namespace dr543 { // dr543: yes
+ // In C++98+DR543, this is valid because value-initialization doesn't call a
+ // trivial default constructor, so we never notice that defining the
+ // constructor would be ill-formed.
+ //
+ // In C++11+DR543, this is ill-formed, because the default constructor is
+ // deleted, and value-initialization *does* call a deleted default
+ // constructor, even if it is trivial.
+ struct A {
+ const int n;
+ };
+ A a = A();
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{deleted}}
+ // expected-note@-5 {{would not be initialized}}
+#endif
+}
+
+namespace dr544 { // dr544: yes
+ int *n;
+
+ template<class T> struct A { int n; };
+ template<class T> struct B : A<T> { int get(); };
+ template<> int B<int>::get() { return n; }
+ int k = B<int>().get();
+}
+
+namespace dr546 { // dr546: yes
+ template<typename T> struct A { void f(); };
+ template struct A<int>;
+ template<typename T> void A<T>::f() { T::error; }
+}
+
+namespace dr547 { // dr547: yes
+ // When targeting the MS x86 ABI, the type of a member function includes a
+ // __thiscall qualifier. This is non-conforming, but we still implement
+ // the intent of dr547
+#if defined(_M_IX86) || (defined(__MINGW32__) && !defined(__MINGW64__))
+#define THISCALL __thiscall
+#else
+#define THISCALL
+#endif
+
+ template<typename T> struct X;
+ template<typename T> struct X<THISCALL T() const> {};
+ template<typename T, typename C> X<T> f(T C::*) { return X<T>(); }
+
+ struct S { void f() const; };
+ X<THISCALL void() const> x = f(&S::f);
+
+#undef THISCALL
+}
+
+namespace dr548 { // dr548: dup 482
+ template<typename T> struct S {};
+ template<typename T> void f() {}
+ template struct dr548::S<int>;
+ template void dr548::f<int>();
+}
+
+namespace dr551 { // dr551: yes c++11
+ // FIXME: This obviously should apply in C++98 mode too.
+ template<typename T> void f() {}
+ template inline void f<int>();
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{cannot be 'inline'}}
+#endif
+
+ template<typename T> inline void g() {}
+ template inline void g<int>();
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{cannot be 'inline'}}
+#endif
+
+ template<typename T> struct X {
+ void f() {}
+ };
+ template inline void X<int>::f();
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{cannot be 'inline'}}
+#endif
+}
+
+namespace dr552 { // dr552: yes
+ template<typename T, typename T::U> struct X {};
+ struct Y { typedef int U; };
+ X<Y, 0> x;
+}
+
+struct dr553_class {
+ friend void *operator new(size_t, dr553_class);
+};
+namespace dr553 {
+ dr553_class c;
+ // Contrary to the apparent intention of the DR, operator new is not actually
+ // looked up with a lookup mechanism that performs ADL; the standard says it
+ // "is looked up in global scope", where it is not visible.
+ void *p = new (c) int; // expected-error {{no matching function}}
+
+ struct namespace_scope {
+ friend void *operator new(size_t, namespace_scope); // expected-error {{cannot be declared inside a namespace}}
+ };
+}
+
+// dr556: na
+
+namespace dr557 { // dr557: yes
+ template<typename T> struct S {
+ friend void f(S<T> *);
+ friend void g(S<S<T> > *);
+ };
+ void x(S<int> *p, S<S<int> > *q) {
+ f(p);
+ g(q);
+ }
+}
+
+namespace dr558 { // dr558: yes
+ wchar_t a = L'\uD7FF';
+ wchar_t b = L'\xD7FF';
+ wchar_t c = L'\uD800'; // expected-error {{invalid universal character}}
+ wchar_t d = L'\xD800';
+ wchar_t e = L'\uDFFF'; // expected-error {{invalid universal character}}
+ wchar_t f = L'\xDFFF';
+ wchar_t g = L'\uE000';
+ wchar_t h = L'\xE000';
+}
+
+template<typename> struct dr559 { typedef int T; dr559::T u; }; // dr559: yes
+
+namespace dr561 { // dr561: yes
+ template<typename T> void f(int);
+ template<typename T> void g(T t) {
+ f<T>(t);
+ }
+ namespace {
+ struct S {};
+ template<typename T> static void f(S);
+ }
+ void h(S s) {
+ g(s);
+ }
+}
+
+namespace dr564 { // dr564: yes
+ extern "C++" void f(int);
+ void f(int); // ok
+ extern "C++" { extern int n; }
+ int n; // ok
+}
+
+namespace dr565 { // dr565: yes
+ namespace N {
+ template<typename T> int f(T); // expected-note {{target}}
+ }
+ using N::f; // expected-note {{using}}
+ template<typename T> int f(T*);
+ template<typename T> void f(T);
+ template<typename T, int = 0> int f(T); // expected-error 0-1{{extension}}
+ template<typename T> int f(T, int = 0);
+ template<typename T> int f(T); // expected-error {{conflicts with}}
+}
+
+namespace dr566 { // dr566: yes
+#if __cplusplus >= 201103L
+ int check[int(-3.99) == -3 ? 1 : -1];
+#endif
+}
+
+// dr567: na
+
+namespace dr568 { // dr568: yes c++11
+ // FIXME: This is a DR issue against C++98, so should probably apply there
+ // too.
+ struct x { int y; };
+ class trivial : x {
+ x y;
+ public:
+ int n;
+ };
+ int check_trivial[__is_trivial(trivial) ? 1 : -1];
+
+ struct std_layout {
+ std_layout();
+ std_layout(const std_layout &);
+ ~std_layout();
+ private:
+ int n;
+ };
+ int check_std_layout[__is_standard_layout(std_layout) ? 1 : -1];
+
+ struct aggregate {
+ int x;
+ int y;
+ trivial t;
+ std_layout sl;
+ };
+ aggregate aggr = {};
+
+ void f(...);
+ void g(trivial t) { f(t); }
+#if __cplusplus < 201103L
+ // expected-error@-2 {{non-POD}}
+#endif
+
+ void jump() {
+ goto x;
+#if __cplusplus < 201103L
+ // expected-error@-2 {{cannot jump}}
+ // expected-note@+2 {{non-POD}}
+#endif
+ trivial t;
+ x: ;
+ }
+}
+
+namespace dr569 { // dr569: yes c++11
+ // FIXME: This is a DR issue against C++98, so should probably apply there
+ // too.
+ ;;;;;
+#if __cplusplus < 201103L
+ // expected-error@-2 {{C++11 extension}}
+#endif
+}
+
+namespace dr570 { // dr570: dup 633
+ int n;
+ int &r = n; // expected-note {{previous}}
+ int &r = n; // expected-error {{redefinition}}
+}
+
+namespace dr571 { // dr571 unknown
+ // FIXME: Add a codegen test.
+ typedef int &ir;
+ int n;
+ const ir r = n; // expected-warning {{has no effect}} FIXME: Test if this has internal linkage.
+}
+
+namespace dr572 { // dr572: yes
+ enum E { a = 1, b = 2 };
+ int check[a + b == 3 ? 1 : -1];
+}
+
+namespace dr573 { // dr573: no
+ void *a;
+ int *b = reinterpret_cast<int*>(a);
+ void (*c)() = reinterpret_cast<void(*)()>(a);
+ void *d = reinterpret_cast<void*>(c);
+#if __cplusplus < 201103L
+ // expected-error@-3 {{extension}}
+ // expected-error@-3 {{extension}}
+#endif
+ void f() { delete a; } // expected-error {{cannot delete}}
+ int n = d - a; // expected-error {{arithmetic on pointers to void}}
+ // FIXME: This is ill-formed.
+ template<void*> struct S;
+ template<int*> struct T;
+}
+
+namespace dr574 { // dr574: yes
+ struct A {
+ A &operator=(const A&) const; // expected-note {{does not match because it is const}}
+ };
+ struct B {
+ B &operator=(const B&) volatile; // expected-note {{nearly matches}}
+ };
+#if __cplusplus >= 201103L
+ struct C {
+ C &operator=(const C&) &; // expected-note {{not viable}} expected-note {{nearly matches}} expected-note {{here}}
+ };
+ struct D {
+ D &operator=(const D&) &&; // expected-note {{not viable}} expected-note {{nearly matches}} expected-note {{here}}
+ };
+ void test(C c, D d) {
+ c = c;
+ C() = c; // expected-error {{no viable}}
+ d = d; // expected-error {{no viable}}
+ D() = d;
+ }
+#endif
+ struct Test {
+ friend A &A::operator=(const A&); // expected-error {{does not match}}
+ friend B &B::operator=(const B&); // expected-error {{does not match}}
+#if __cplusplus >= 201103L
+ // FIXME: We shouldn't produce the 'cannot overload' diagnostics here.
+ friend C &C::operator=(const C&); // expected-error {{does not match}} expected-error {{cannot overload}}
+ friend D &D::operator=(const D&); // expected-error {{does not match}} expected-error {{cannot overload}}
+#endif
+ };
+}
+
+namespace dr575 { // dr575: yes
+ template<typename T, typename U = typename T::type> void a(T); void a(...); // expected-error 0-1{{extension}}
+ template<typename T, typename T::type U = 0> void b(T); void b(...); // expected-error 0-1{{extension}}
+ template<typename T, int U = T::value> void c(T); void c(...); // expected-error 0-1{{extension}}
+ template<typename T> void d(T, int = T::value); void d(...); // expected-error {{cannot be used prior to '::'}}
+ void x() {
+ a(0);
+ b(0);
+ c(0);
+ d(0); // expected-note {{in instantiation of default function argument}}
+ }
+
+ template<typename T = int&> void f(T* = 0); // expected-error 0-1{{extension}}
+ template<typename T = int> void f(T = 0); // expected-error 0-1{{extension}}
+ void g() { f<>(); }
+
+ template<typename T> T &h(T *);
+ template<typename T> T *h(T *);
+ void *p = h((void*)0);
+}
+
+namespace dr576 { // dr576: yes
+ typedef void f() {} // expected-error {{function definition declared 'typedef'}}
+ void f(typedef int n); // expected-error {{invalid storage class}}
+ void f(char c) { typedef int n; }
+}
+
+namespace dr577 { // dr577: yes
+ typedef void V;
+ typedef const void CV;
+ void a(void);
+ void b(const void); // expected-error {{qualifiers}}
+ void c(V);
+ void d(CV); // expected-error {{qualifiers}}
+ void (*e)(void) = c;
+ void (*f)(const void); // expected-error {{qualifiers}}
+ void (*g)(V) = a;
+ void (*h)(CV); // expected-error {{qualifiers}}
+ template<typename T> void i(T); // expected-note 2{{requires 1 arg}}
+ template<typename T> void j(void (*)(T)); // expected-note 2{{argument may not have 'void' type}}
+ void k() {
+ a();
+ c();
+ i<void>(); // expected-error {{no match}}
+ i<const void>(); // expected-error {{no match}}
+ j<void>(0); // expected-error {{no match}}
+ j<const void>(0); // expected-error {{no match}}
+ }
+}
+
+namespace dr580 { // dr580: no
+ class C;
+ struct A { static C c; };
+ struct B { static C c; };
+ class C {
+ C(); // expected-note {{here}}
+ ~C(); // expected-note {{here}}
+
+ typedef int I; // expected-note {{here}}
+ template<int> struct X;
+ template<int> friend struct Y;
+ template<int> void f();
+ template<int> friend void g();
+ friend struct A;
+ };
+
+ template<C::I> struct C::X {};
+ template<C::I> struct Y {};
+ template<C::I> struct Z {}; // FIXME: should reject, accepted because C befriends A!
+
+ template<C::I> void C::f() {}
+ template<C::I> void g() {}
+ template<C::I> void h() {} // expected-error {{private}}
+
+ C A::c;
+ C B::c; // expected-error 2{{private}}
+}
+
+// dr582: na
+
+namespace dr583 { // dr583: no
+ // see n3624
+ int *p;
+ // FIXME: These are all ill-formed.
+ bool b1 = p < 0;
+ bool b2 = p > 0;
+ bool b3 = p <= 0;
+ bool b4 = p >= 0;
+}
+
+// dr584: na
+
+namespace dr585 { // dr585: yes
+ template<typename> struct T;
+ struct A {
+ friend T; // expected-error {{requires a type specifier}} expected-error {{can only be classes or functions}}
+ // FIXME: It's not clear whether the standard allows this or what it means,
+ // but the DR585 writeup suggests it as an alternative.
+ template<typename U> friend T<U>; // expected-error {{must use an elaborated type}}
+ };
+ template<template<typename> class T> struct B {
+ friend T; // expected-error {{requires a type specifier}} expected-error {{can only be classes or functions}}
+ template<typename U> friend T<U>; // expected-error {{must use an elaborated type}}
+ };
+}
+
+// dr586: na
+
+namespace dr587 { // dr587: yes
+ template<typename T> void f(bool b, const T x, T y) {
+ const T *p = &(b ? x : y);
+ }
+ struct S {};
+ template void f(bool, const int, int);
+ template void f(bool, const S, S);
+}
+
+namespace dr588 { // dr588: yes
+ struct A { int n; }; // expected-note {{ambiguous}}
+ template<typename T> int f() {
+ struct S : A, T { int f() { return n; } } s;
+ int a = s.f();
+ int b = s.n; // expected-error {{found in multiple}}
+ }
+ struct B { int n; }; // expected-note {{ambiguous}}
+ int k = f<B>(); // expected-note {{here}}
+}
+
+namespace dr589 { // dr589: yes
+ struct B { };
+ struct D : B { };
+ D f();
+ extern const B &b;
+ bool a;
+ const B *p = &(a ? f() : b); // expected-error {{temporary}}
+ const B *q = &(a ? D() : b); // expected-error {{temporary}}
+}
+
+namespace dr590 { // dr590: yes
+ template<typename T> struct A {
+ struct B {
+ struct C {
+ A<T>::B::C f(A<T>::B::C); // ok, no 'typename' required.
+ };
+ };
+ };
+ template<typename T> typename A<T>::B::C A<T>::B::C::f(A<T>::B::C) {}
+}
+
+namespace dr591 { // dr591: no
+ template<typename T> struct A {
+ typedef int M;
+ struct B {
+ typedef void M;
+ struct C;
+ };
+ };
+
+ template<typename T> struct A<T>::B::C : A<T> {
+ // FIXME: Should find member of non-dependent base class A<T>.
+ M m; // expected-error {{incomplete type 'M' (aka 'void'}}
+ };
+}
+
+// dr592: na
+// dr593 needs an IRGen test.
+// dr594: na
+
+namespace dr595 { // dr595: dup 1330
+ template<class T> struct X {
+ void f() throw(T) {}
+ };
+ struct S {
+ X<S> xs;
+ };
+}
+
+// dr597: na
+
+namespace dr598 { // dr598: yes
+ namespace N {
+ void f(int);
+ void f(char);
+ // Not found by ADL.
+ void g(void (*)(int));
+ void h(void (*)(int));
+
+ namespace M {
+ struct S {};
+ int &h(void (*)(S));
+ }
+ void i(M::S);
+ void i();
+ }
+ int &g(void(*)(char));
+ int &r = g(N::f);
+ int &s = h(N::f); // expected-error {{undeclared}}
+ int &t = h(N::i);
+}
+
+namespace dr599 { // dr599: partial
+ typedef int Fn();
+ struct S { operator void*(); };
+ struct T { operator Fn*(); };
+ struct U { operator int*(); operator void*(); }; // expected-note 2{{conversion}}
+ struct V { operator int*(); operator Fn*(); };
+ void f(void *p, void (*q)(), S s, T t, U u, V v) {
+ delete p; // expected-error {{cannot delete}}
+ delete q; // expected-error {{cannot delete}}
+ delete s; // expected-error {{cannot delete}}
+ delete t; // expected-error {{cannot delete}}
+ // FIXME: This is valid, but is rejected due to a non-conforming GNU
+ // extension allowing deletion of pointers to void.
+ delete u; // expected-error {{ambiguous}}
+ delete v;
+ }
+}
diff --git a/test/CXX/drs/dr6xx.cpp b/test/CXX/drs/dr6xx.cpp
new file mode 100644
index 0000000000000..988c8f43011d0
--- /dev/null
+++ b/test/CXX/drs/dr6xx.cpp
@@ -0,0 +1,349 @@
+// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+
+namespace std { struct type_info {}; }
+
+namespace dr601 { // dr601: yes
+#if __cplusplus >= 201103L
+#define MAX __LLONG_MAX__
+#else
+#define MAX __LONG_MAX__
+#endif
+
+#if 0x8000 < -1
+#error 0x8000 should be signed
+#endif
+
+#if MAX > 0xFFFFFFFF && 0x80000000 < -1
+#error 0x80000000 should be signed
+#endif
+
+#if __INT_MAX__ == 0x7FFFFFFF
+_Static_assert(0x80000000 < -1, "0x80000000 should be unsigned"); // expected-error {{C11}}
+#endif
+
+#if MAX > 0xFFFFFFFFFFFFFFFF && 0x8000000000000000 < -1
+#error 0x8000000000000000 should be signed
+#endif
+
+#if __cplusplus >= 201103L && __LLONG_MAX__ == 0x7FFFFFFFFFFFFFFF
+static_assert(0x8000000000000000 < -1, "0x8000000000000000 should be unsigned"); // expected-error {{C11}}
+#endif
+
+#undef MAX
+}
+
+namespace dr602 { // dr602: yes
+ template<class T> struct A {
+ template<class U> friend struct A;
+ };
+
+ template<class T> struct B {
+ class C {
+ template<class U> friend struct B;
+ typedef int type;
+ };
+ typename C::type ct; // ok, befriended
+ };
+ B<int> b;
+}
+
+namespace dr603 { // dr603: yes
+ template<unsigned char> struct S {};
+ typedef S<'\001'> S1;
+ typedef S<(1ul << __CHAR_BIT__) + 1> S1;
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{cannot be narrowed}}
+#endif
+}
+
+// dr604: na
+// dr605 needs IRGen test
+
+namespace dr606 { // dr606: yes
+#if __cplusplus >= 201103L
+ template<typename T> struct S {};
+ template<typename T> void f(S<T> &&); // expected-note {{no known conversion from 'S<int>' to 'S<int> &&'}}
+ template<typename T> void g(T &&);
+ template<typename T> void h(const T &&); // expected-note {{no known conversion from 'S<int>' to 'const dr606::S<int> &&'}}
+
+ void test(S<int> s) {
+ f(s); // expected-error {{no match}}
+ g(s);
+ h(s); // expected-error {{no match}}
+
+ g(test);
+ h(test); // ok, an rvalue reference can bind to a function lvalue
+ }
+#endif
+}
+
+namespace dr608 { // dr608: yes
+ struct A { virtual void f(); };
+ struct B : A {};
+ struct C : A { void f(); };
+ struct D : B, C {};
+}
+
+int dr610[-0u == 0u ? 1 : -1]; // dr610: yes
+
+namespace dr611 { // dr611: yes
+ int k;
+ struct S { int &r; } s = { k ? k : k };
+}
+
+// dr612: na
+
+namespace dr613 { // dr613: yes c++11
+ // see also n2253
+ struct A { int n; static void f(); };
+ int f(int);
+ struct B { virtual void f(); };
+ B &g(int);
+
+ int an1 = sizeof(A::n);
+ int an2 = sizeof(A::n + 1); // valid per dr850
+ int an3 = sizeof A::n;
+ int an4 = sizeof(f(A::n));
+ int an5 = sizeof(g(A::n));
+ const std::type_info &an6 = typeid(A::n);
+ const std::type_info &an7 = typeid(A::n + 1);
+ const std::type_info &an8 = typeid(f(A::n));
+ const std::type_info &an9 = typeid(g(A::n)); // expected-error {{non-static}}
+#if __cplusplus < 201103L
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+ // expected-error@-10 {{non-static}}
+#endif
+
+ void A::f() {
+ int an1 = sizeof n;
+ const std::type_info &an2 = typeid(n + 1);
+#if __cplusplus < 201103L
+ // expected-error@-3 {{static}}
+ // expected-error@-3 {{static}}
+#endif
+ const std::type_info &an3 = typeid(g(n)); // expected-error {{static}}
+ }
+}
+
+int dr614_a[(-1) / 2 == 0 ? 1 : -1]; // dr614: yes
+int dr614_b[(-1) % 2 == -1 ? 1 : -1];
+
+namespace dr615 { // dr615: yes
+ int f();
+ static int n = f();
+}
+
+namespace dr616 { // dr616: no
+#if __cplusplus >= 201103L
+ struct S { int n; } s;
+ // FIXME: These should all be 'int &&'
+ using T = decltype(S().n); // expected-note 2{{previous}}
+ using T = decltype(static_cast<S&&>(s).n);
+ using T = decltype(S().*&S::n);
+ using T = decltype(static_cast<S&&>(s).*&S::n); // expected-error {{different type}}
+ using T = int&&; // expected-error {{different type}}
+#endif
+}
+
+namespace dr618 { // dr618: yes
+#if (unsigned)-1 > 0
+#error wrong
+#endif
+}
+
+namespace dr619 { // dr619: yes
+ extern int x[10];
+ struct S { static int x[10]; };
+
+ int x[];
+ _Static_assert(sizeof(x) == sizeof(int) * 10, ""); // expected-error {{C11}}
+ extern int x[];
+ _Static_assert(sizeof(x) == sizeof(int) * 10, ""); // expected-error {{C11}}
+
+ int S::x[];
+ _Static_assert(sizeof(S::x) == sizeof(int) * 10, ""); // expected-error {{C11}}
+
+ void f() {
+ extern int x[];
+ sizeof(x); // expected-error {{incomplete}}
+ }
+}
+
+// dr620: dup 568
+
+namespace dr621 {
+ template<typename T> T f();
+ template<> int f() {} // expected-note {{previous}}
+ template<> int f<int>() {} // expected-error {{redefinition}}
+}
+
+// dr623: na
+// FIXME: Add documentation saying we allow invalid pointer values.
+
+// dr624 needs an IRGen check.
+
+namespace dr625 { // dr625: yes
+ template<typename T> struct A {};
+ A<auto> x = A<int>(); // expected-error {{'auto' not allowed in template argument}} expected-error 0-1{{extension}}
+ void f(int);
+ void (*p)(auto) = f; // expected-error {{'auto' not allowed in function prototype}} expected-error 0-1{{extension}}
+}
+
+namespace dr626 { // dr626: yes
+#define STR(x) #x
+ char c[2] = STR(c); // ok, type matches
+ wchar_t w[2] = STR(w); // expected-error {{initializing wide char array with non-wide string literal}}
+}
+
+namespace dr627 { // dr627: yes
+ void f() {
+ true a = 0; // expected-error +{{}} expected-warning {{unused}}
+ }
+}
+
+// dr628: na
+
+namespace dr629 { // dr629: yes
+ typedef int T;
+ int n = 1;
+ void f() {
+ auto T = 2;
+#if __cplusplus < 201103L
+ // expected-error@-2 {{expected unqualified-id}}
+#else
+ // expected-note@-4 {{previous}}
+#endif
+
+ auto T(n);
+#if __cplusplus >= 201103L
+ // expected-error@-2 {{redefinition of 'T'}}
+#endif
+ }
+}
+
+namespace dr630 { // dr630: yes
+const bool MB_EQ_WC =
+ ' ' == L' ' && '\t' == L'\t' && '\v' == L'\v' && '\r' == L'\r' &&
+ '\n' == L'\n' && //
+ 'a' == L'a' && 'b' == L'b' && 'c' == L'c' && 'd' == L'd' && 'e' == L'e' &&
+ 'f' == L'f' && 'g' == L'g' && 'h' == L'h' && 'i' == L'i' && 'j' == L'j' &&
+ 'k' == L'k' && 'l' == L'l' && 'm' == L'm' && 'n' == L'n' && 'o' == L'o' &&
+ 'p' == L'p' && 'q' == L'q' && 'r' == L'r' && 's' == L's' && 't' == L't' &&
+ 'u' == L'u' && 'v' == L'v' && 'w' == L'w' && 'x' == L'x' && 'y' == L'y' &&
+ 'z' == L'z' && //
+ 'A' == L'A' && 'B' == L'B' && 'C' == L'C' && 'D' == L'D' && 'E' == L'E' &&
+ 'F' == L'F' && 'G' == L'G' && 'H' == L'H' && 'I' == L'I' && 'J' == L'J' &&
+ 'K' == L'K' && 'L' == L'L' && 'M' == L'M' && 'N' == L'N' && 'O' == L'O' &&
+ 'P' == L'P' && 'Q' == L'Q' && 'R' == L'R' && 'S' == L'S' && 'T' == L'T' &&
+ 'U' == L'U' && 'V' == L'V' && 'W' == L'W' && 'X' == L'X' && 'Y' == L'Y' &&
+ 'Z' == L'Z' && //
+ '0' == L'0' && '1' == L'1' && '2' == L'2' && '3' == L'3' && '4' == L'4' &&
+ '5' == L'5' && '6' == L'6' && '7' == L'7' && '8' == L'8' &&
+ '9' == L'9' && //
+ '_' == L'_' && '{' == L'{' && '}' == L'}' && '[' == L'[' && ']' == L']' &&
+ '#' == L'#' && '(' == L'(' && ')' == L')' && '<' == L'<' && '>' == L'>' &&
+ '%' == L'%' && ':' == L':' && ';' == L';' && '.' == L'.' && '?' == L'?' &&
+ '*' == L'*' && '+' == L'+' && '-' == L'-' && '/' == L'/' && '^' == L'^' &&
+ '&' == L'&' && '|' == L'|' && '~' == L'~' && '!' == L'!' && '=' == L'=' &&
+ ',' == L',' && '\\' == L'\\' && '"' == L'"' && '\'' == L'\'';
+#if __STDC_MB_MIGHT_NEQ_WC__
+#ifndef __FreeBSD__ // PR22208, FreeBSD expects us to give a bad (but conforming) answer here.
+_Static_assert(!MB_EQ_WC, "__STDC_MB_MIGHT_NEQ_WC__ but all basic source characters have same representation"); // expected-error {{C11}}
+#endif
+#else
+_Static_assert(MB_EQ_WC, "!__STDC_MB_MIGHT_NEQ_WC__ but some character differs"); // expected-error {{C11}}
+#endif
+}
+
+// dr631: na
+
+namespace dr632 { // dr632: yes
+ struct S { int n; } s = {{5}}; // expected-warning {{braces}}
+}
+
+// dr633: na
+// see also n2993
+
+namespace dr634 { // dr634: yes
+ struct S { S(); S(const S&); virtual void f(); ~S(); };
+ int f(...);
+ char f(int);
+ template<typename T> int (&g(T))[sizeof f(T())];
+ int (&a)[sizeof(int)] = g(S());
+ int (&b)[1] = g(0);
+ int k = f(S()); // expected-error {{cannot pass}}
+}
+
+namespace dr635 { // dr635: yes
+ template<typename T> struct A { A(); ~A(); };
+ template<typename T> A<T>::A<T>() {} // expected-error {{cannot have template arguments}}
+ template<typename T> A<T>::~A<T>() {}
+
+ template<typename T> struct B { B(); ~B(); };
+ template<typename T> B<T>::B() {}
+ template<typename T> B<T>::~B() {}
+
+ struct C { template<typename T> C(); C(); };
+ template<typename T> C::C() {}
+ C::C() {}
+ template<> C::C<int>() {} // expected-error {{constructor name}} expected-error {{unqualified-id}}
+ /*FIXME: needed for error recovery:*/;
+
+ template<typename T> struct D { template<typename U> D(); D(); };
+ template<typename T> D<T>::D() {} // expected-note {{previous}}
+ template<typename T> template<typename U> D<T>::D() {}
+ template<typename T> D<T>::D<T>() {} // expected-error {{redefinition}} expected-error {{cannot have template arg}}
+}
+
+namespace dr637 { // dr637: yes
+ void f(int i) {
+ i = ++i + 1;
+ i = i++ + 1; // expected-warning {{unsequenced}}
+ }
+}
+
+namespace dr638 { // dr638: no
+ template<typename T> struct A {
+ struct B;
+ void f();
+ void g();
+ struct C {
+ void h();
+ };
+ };
+
+ class X {
+ typedef int type;
+ template<class T> friend struct A<T>::B; // expected-warning {{not supported}}
+ template<class T> friend void A<T>::f(); // expected-warning {{not supported}}
+ template<class T> friend void A<T>::g(); // expected-warning {{not supported}}
+ template<class T> friend void A<T>::C::h(); // expected-warning {{not supported}}
+ };
+
+ template<> struct A<int> {
+ X::type a; // FIXME: private
+ struct B {
+ X::type b; // ok
+ };
+ int f() { X::type c; } // FIXME: private
+ void g() { X::type d; } // ok
+ struct D {
+ void h() { X::type e; } // FIXME: private
+ };
+ };
+}
+
+namespace dr639 { // dr639: yes
+ void f(int i) {
+ void((i = 0) + (i = 0)); // expected-warning {{unsequenced}}
+ }
+}
diff --git a/test/CXX/drs/dr9xx.cpp b/test/CXX/drs/dr9xx.cpp
index 40dc2821adc31..4bcd6565e0686 100644
--- a/test/CXX/drs/dr9xx.cpp
+++ b/test/CXX/drs/dr9xx.cpp
@@ -1,6 +1,7 @@
// RUN: %clang_cc1 -std=c++98 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
// RUN: %clang_cc1 -std=c++11 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
-// RUN: %clang_cc1 -std=c++1y %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++14 %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
+// RUN: %clang_cc1 -std=c++1z %s -verify -fexceptions -fcxx-exceptions -pedantic-errors
#if __cplusplus < 201103L
// expected-no-diagnostics
diff --git a/test/CXX/except/except.spec/p1.cpp b/test/CXX/except/except.spec/p1.cpp
index a32f37d55208e..fa53c9f5d23f4 100644
--- a/test/CXX/except/except.spec/p1.cpp
+++ b/test/CXX/except/except.spec/p1.cpp
@@ -77,5 +77,12 @@ namespace PR11084 {
static int f() noexcept(1/X) { return 10; } // expected-error{{argument to noexcept specifier must be a constant expression}} expected-note{{division by zero}}
};
- void g() { A<0>::f(); } // expected-note{{in instantiation of exception specification for 'f' requested here}}
+ template<int X> void f() {
+ int (*p)() noexcept(1/X); // expected-error{{argument to noexcept specifier must be a constant expression}} expected-note{{division by zero}}
+ };
+
+ void g() {
+ A<0>::f(); // expected-note{{in instantiation of exception specification for 'f'}}
+ f<0>(); // expected-note{{in instantiation of function template specialization}}
+ }
}
diff --git a/test/CXX/except/except.spec/p5-delayed.cpp b/test/CXX/except/except.spec/p5-delayed.cpp
new file mode 100644
index 0000000000000..99c0e2de31a99
--- /dev/null
+++ b/test/CXX/except/except.spec/p5-delayed.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -std=c++11 -verify %s -fexceptions -fcxx-exceptions
+
+struct A { struct X { virtual ~X() throw(Y); }; struct Y : X {}; };
+struct B { struct X { virtual void f() throw(Y); }; struct Y : X { void f() throw(Y); }; };
+struct C { struct X { virtual void f() throw(Y); }; struct Y : X { void f() throw(); }; };
+struct D { struct X { virtual void f() throw(Y); }; struct Y : X { void f() noexcept; }; };
+struct E { struct Y; struct X { virtual Y &operator=(const Y&) throw(Y); }; struct Y : X {}; };
+struct F {
+ struct X {
+ virtual void f() throw(Y); // expected-note {{here}}
+ };
+ struct Y : X {
+ void f() throw(int); // expected-error {{more lax}}
+ };
+};
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp
index bcf45a0c05b4d..d027c7a388bb3 100644
--- a/test/CXX/expr/expr.const/p2-0x.cpp
+++ b/test/CXX/expr/expr.const/p2-0x.cpp
@@ -131,14 +131,14 @@ namespace IncompleteClassTypeAddr {
namespace UndefinedBehavior {
void f(int n) {
switch (n) {
- case (int)4.4e9: // expected-error {{constant expression}} expected-note {{value 4.4E+9 is outside the range of representable values of type 'int'}} expected-note {{previous case defined here}}
+ case (int)4.4e9: // expected-error {{constant expression}} expected-note {{value 4.4E+9 is outside the range of representable values of type 'int'}}
case (int)0x80000000u: // ok
case (int)10000000000ll: // expected-note {{here}}
case (unsigned int)10000000000ll: // expected-error {{duplicate case value}}
case (int)(unsigned)(long long)4.4e9: // ok
- case (int)(float)1e300: // expected-error {{constant expression}} expected-note {{value 1.0E+300 is outside the range of representable values of type 'float'}} expected-error {{duplicate case value '2147483647'}} expected-note {{previous case defined here}}
+ case (int)(float)1e300: // expected-error {{constant expression}} expected-note {{value 1.0E+300 is outside the range of representable values of type 'float'}}
case (int)((float)1e37 / 1e30): // ok
- case (int)(__fp16)65536: // expected-error {{constant expression}} expected-note {{value 65536 is outside the range of representable values of type '__fp16'}} expected-error {{duplicate case value '2147483647'}}
+ case (int)(__fp16)65536: // expected-error {{constant expression}} expected-note {{value 65536 is outside the range of representable values of type '__fp16'}}
break;
}
}
@@ -277,7 +277,7 @@ namespace UndefinedBehavior {
// - a lambda-expression (5.1.2);
struct Lambda {
- int n : []{ return 1; }(); // expected-error {{constant expression}} expected-error {{integral constant expression}}
+ int n : []{ return 1; }(); // expected-error {{constant expression}} expected-error {{integral constant expression}} expected-note {{non-literal type}}
};
// - an lvalue-to-rvalue conversion (4.1) unless it is applied to
diff --git a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
index fd90482ae8d2a..0e948ce00031e 100644
--- a/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.general/p3-0x.cpp
@@ -136,12 +136,11 @@ namespace Static {
namespace PR12564 {
struct Base {
- void bar(Base&) {} // FIXME: expected-note {{here}}
+ void bar(Base&) {}
};
struct Derived : Base {
- // FIXME: This should be accepted.
- void foo(Derived& d) noexcept(noexcept(d.bar(d))) {} // expected-error {{cannot bind to a value of unrelated type}}
+ void foo(Derived& d) noexcept(noexcept(d.bar(d))) {}
};
}
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp
index 35b77896c868e..40360e40694c1 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p19.cpp
@@ -7,10 +7,10 @@ struct MoveOnly {
template<typename T> T &&move(T&);
void test_special_member_functions(MoveOnly mo, int i) {
- auto lambda1 = [i]() { }; // expected-note 2 {{lambda expression begins here}}
+ auto lambda1 = [i]() { }; // expected-note {{lambda expression begins here}} expected-note 2{{candidate}}
// Default constructor
- decltype(lambda1) lambda2; // expected-error{{call to implicitly-deleted default constructor of 'decltype(lambda1)' (aka '(lambda}}
+ decltype(lambda1) lambda2; // expected-error{{no matching constructor}}
// Copy assignment operator
lambda1 = lambda1; // expected-error{{copy assignment operator is implicitly deleted}}
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
index 03147a692dd54..d791ed60cfca4 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p2-generic-lambda-1y.cpp
@@ -18,7 +18,7 @@ void unevaluated_operand(P &p, int i) { //expected-note{{declared here}}
// FIXME: this should only emit one error.
int i2 = sizeof([](auto a, auto b)->void{}(3, '4')); // expected-error{{lambda expression in an unevaluated operand}} \
// expected-error{{invalid application of 'sizeof'}}
- const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i));
+ const std::type_info &ti1 = typeid([](auto &a) -> P& { static P p; return p; }(i)); // expected-warning {{expression with side effects will be evaluated despite being used as an operand to 'typeid'}}
const std::type_info &ti2 = typeid([](auto) -> int { return i; }(i)); // expected-error{{lambda expression in an unevaluated operand}}\
// expected-error{{cannot be implicitly captured}}\
// expected-note{{begins here}}
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
index 1fbe28722a41d..647c76d604e43 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -Wno-unused-value %s -verify
// prvalue
void prvalue() {
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
index 562f92a78bbcc..80771d7a229a5 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p3.cpp
@@ -1,6 +1,11 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 %s -verify
void test_nonaggregate(int i) {
- auto lambda = [i]() -> void {}; // expected-note 3{{candidate constructor}}
+ auto lambda = [i]() -> void {}; // expected-note 2{{candidate constructor}}
decltype(lambda) foo = { 1 }; // expected-error{{no matching constructor}}
+ static_assert(!__is_literal(decltype(lambda)), "");
+
+ auto lambda2 = []{}; // expected-note 2{{candidate constructor}}
+ decltype(lambda2) bar = {}; // expected-error{{no matching constructor}}
+ static_assert(!__is_literal(decltype(lambda2)), "");
}
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
index 1016cb1d3056c..a36175af6fec5 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p4.cpp
@@ -34,15 +34,12 @@ X infer_X_return_type(X x) {
}(5);
}
-X infer_X_return_type_fail(X x) {
+X infer_X_return_type_2(X x) {
return [x](int y) {
if (y > 0)
return X();
else
- return x;
-#if __cplusplus <= 201103L
- // expected-error@-2 {{return type 'const X' must match previous return type 'X' when lambda expression has unspecified explicit return type}}
-#endif
+ return x; // ok even in c++11, per dr1048.
}(5);
}
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
index 407b083231a3f..90cbf02b2a6a7 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
@@ -140,11 +140,11 @@ namespace NonLocalLambdaInstantation {
}
template<typename T>
- struct X2 {
+ struct X2 { // expected-note{{in instantiation of default member initializer 'NonLocalLambdaInstantation::X2<int *>::x' requested here}}
int x = []{ return T(); }(); // expected-error{{cannot initialize a member subobject of type 'int' with an rvalue of type 'int *'}}
};
X2<int> x2i;
X2<float> x2f;
- X2<int*> x2ip; // expected-note{{in instantiation of template class 'NonLocalLambdaInstantation::X2<int *>' requested here}}
+ X2<int*> x2ip; // expected-note{{implicit default constructor for 'NonLocalLambdaInstantation::X2<int *>' first required here}}
}
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
index 427e8c5007f2e..a2a57956df9bc 100644
--- a/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -fms-extensions -Wno-delete-incomplete %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -fms-extensions -Wno-delete-incomplete -Wno-unused-value %s
// expected-no-diagnostics
#define P(e) static_assert(noexcept(e), "expected nothrow")
diff --git a/test/CXX/lex/lex.literal/lex.ext/p3.cpp b/test/CXX/lex/lex.literal/lex.ext/p3.cpp
index e812ddddd8a46..d764989312c24 100644
--- a/test/CXX/lex/lex.literal/lex.ext/p3.cpp
+++ b/test/CXX/lex/lex.literal/lex.ext/p3.cpp
@@ -9,7 +9,7 @@ int &i2 = 45_x1;
template<char...> char &operator "" _x1 ();
int &i3 = 0377_x1;
-int &i4 = 90000000000000000000000000000000000000000000000_x1; // expected-error {{integer constant is larger than the largest unsigned integer type}}
+int &i4 = 90000000000000000000000000000000000000000000000_x1; // expected-error {{integer literal is too large to be represented in any integer type}}
double &operator "" _x2 (const char *);
double &i5 = 123123123123123123123123123123123123123123123_x2;
diff --git a/test/CXX/lex/lex.trigraph/p1.cpp b/test/CXX/lex/lex.trigraph/p1.cpp
index aacbc55b28feb..a80b00eabe7eb 100644
--- a/test/CXX/lex/lex.trigraph/p1.cpp
+++ b/test/CXX/lex/lex.trigraph/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -ftrigraphs -Wtrigraphs -verify %s
??=pragma // expected-warning {{trigraph converted to '#' character}}
diff --git a/test/CXX/lex/lex.trigraph/p2.cpp b/test/CXX/lex/lex.trigraph/p2.cpp
index 7d11d5bf5d592..6502aa8d79210 100644
--- a/test/CXX/lex/lex.trigraph/p2.cpp
+++ b/test/CXX/lex/lex.trigraph/p2.cpp
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -ftrigraphs -Wtrigraphs -verify %s
??=define arraycheck(a,b) a??(b??) ??!??! b??(a??) // expected-warning {{trigraph converted to '#' character}} expected-warning {{trigraph converted to '[' character}} expected-warning {{trigraph converted to ']' character}} expected-warning {{trigraph converted to '|' character}} expected-warning {{trigraph converted to '|' character}} expected-warning {{trigraph converted to '[' character}} expected-warning {{trigraph converted to ']' character}}
diff --git a/test/CXX/lex/lex.trigraph/p3.cpp b/test/CXX/lex/lex.trigraph/p3.cpp
index c74d8f358d027..bf935708a243e 100644
--- a/test/CXX/lex/lex.trigraph/p3.cpp
+++ b/test/CXX/lex/lex.trigraph/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -trigraphs -Wtrigraphs -verify %s
+// RUN: %clang_cc1 -fsyntax-only -ftrigraphs -Wtrigraphs -verify %s
// expected-no-diagnostics
char a[] =
diff --git a/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp b/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp
index 574cb40c4670f..d7726c944cdb4 100644
--- a/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp
+++ b/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp
@@ -30,11 +30,11 @@ struct Y {
void f();
void test_Y() {
- goto end; // expected-error{{goto into protected scope}}
+ goto end; // expected-error{{cannot jump from this goto statement to its label}}
Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
end:
f();
- goto inner; // expected-error{{goto into protected scope}}
+ goto inner; // expected-error{{cannot jump from this goto statement to its label}}
{
Y y2; // expected-note{{jump bypasses variable with a non-trivial destructor}}
inner:
diff --git a/test/CXX/stmt.stmt/stmt.dcl/p3.cpp b/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
index f52e3b6d142db..4bcc648e84aa5 100644
--- a/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
+++ b/test/CXX/stmt.stmt/stmt.dcl/p3.cpp
@@ -29,7 +29,7 @@ struct Y {
};
void test_Y() {
- goto end; // expected-error{{goto into protected scope}}
+ goto end; // expected-error{{cannot jump from this goto statement to its label}}
Y y; // expected-note{{jump bypasses variable with a non-trivial destructor}}
end:
return;
@@ -40,7 +40,7 @@ struct Z {
};
void test_Z() {
- goto end; // expected-error{{goto into protected scope}}
+ goto end; // expected-error{{cannot jump from this goto statement to its label}}
Z z; // expected-note{{jump bypasses initialization of non-POD variable}}
end:
return;
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
index 8a3168e5f8068..b0305dd756a65 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.static/p1.cpp
@@ -8,7 +8,7 @@ struct X0 {
template<typename T>
T X0<T>::value = 0; // expected-error{{no viable conversion}}
-struct X1 {
+struct X1 {
X1(int);
};
@@ -19,8 +19,8 @@ X1& get_X1() { return X0<X1>::value; }
double*& get_double_ptr() { return X0<int*>::value; } // expected-error{{non-const lvalue reference to type 'double *' cannot bind to a value of unrelated type 'int *'}}
-X2& get_X2() {
+X2& get_X2() {
return X0<X2>::value; // expected-note{{instantiation}}
}
-
-template<typename T> T x; // expected-warning{{variable templates are a C++1y extension}}
+
+template<typename T> T x; // expected-warning{{variable templates are a C++14 extension}}
diff --git a/test/CXX/temp/temp.decls/temp.friend/p5.cpp b/test/CXX/temp/temp.decls/temp.friend/p5.cpp
index b26abb64f8383..c4f9d63b7c665 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p5.cpp
@@ -20,7 +20,7 @@ namespace test1 {
class C {
static void foo();
- template <class T> friend void A<T>::f();
+ template <class T> friend void A<T>::f(); // expected-warning {{not supported}}
};
template <class T> struct A {
@@ -42,7 +42,7 @@ namespace test2 {
class C {
static void foo();
- template <class T> friend void A<T>::g();
+ template <class T> friend void A<T>::g(); // expected-warning {{not supported}}
};
template <class T> struct A {
@@ -86,7 +86,7 @@ namespace test4 {
template <class V>
template <class U>
- friend void X<V>::operator+=(U);
+ friend void X<V>::operator+=(U); // expected-warning {{not supported}}
};
void test() {
@@ -96,7 +96,7 @@ namespace test4 {
namespace test5 {
template<template <class> class T> struct A {
- template<template <class> class U> friend void A<U>::foo();
+ template<template <class> class U> friend void A<U>::foo(); // expected-warning {{not supported}}
};
template <class> struct B {};
diff --git a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
index 73cbd0749cbd2..f1231f61111e3 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
@@ -243,7 +243,7 @@ namespace FunctionTypes {
};
template<typename R, typename ...Types>
- struct Arity<R(Types......)> {
+ struct Arity<R(Types......)> { // expected-warning {{varargs}} expected-note {{pack}} expected-note {{insert ','}}
static const unsigned value = sizeof...(Types);
};
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
index dae6865666916..4f9368f6b6050 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -354,6 +354,7 @@ void test_unexpanded_exprs(Types ...values) {
for (auto t : values) { } // expected-error{{expression contains unexpanded parameter pack 'values'}}
switch (values) { } // expected-error{{expression contains unexpanded parameter pack 'values'}}
+ switch (0) { case 0: case values: ; } // expected-error{{expression contains unexpanded parameter pack 'values'}}
do { } while (values); // expected-error{{expression contains unexpanded parameter pack 'values'}}
@@ -422,3 +423,17 @@ namespace PR16303 {
B<1,2>::C<4,5,6> c1; // expected-note{{in instantiation of}}
B<1,2,3,4>::C<4,5,6> c2; // expected-note{{in instantiation of}}
}
+
+namespace PR21289 {
+ template<int> using T = int;
+ template<typename> struct S { static const int value = 0; };
+ template<typename> const int vt = 0; // expected-warning {{extension}}
+ int f(...);
+ template<int ...Ns> void g() {
+ f(T<Ns>()...);
+ f(S<T<Ns>>::value...);
+ f(vt<T<Ns>>...);
+ }
+ template void g<>();
+ template void g<1, 2, 3>();
+}
diff --git a/test/CXX/temp/temp.param/p5.cpp b/test/CXX/temp/temp.param/p5.cpp
index c25868267e494..ab430fb8741f8 100644
--- a/test/CXX/temp/temp.param/p5.cpp
+++ b/test/CXX/temp/temp.param/p5.cpp
@@ -1,13 +1,13 @@
// RUN: %clang_cc1 -verify %s -std=c++11
-template<const int I> struct S {
+template<const int I> struct S { // expected-note {{instantiation}}
decltype(I) n;
int &&r = I; // expected-warning 2{{binding reference member 'r' to a temporary value}} expected-note 2{{declared here}}
};
-S<5> s; // expected-note {{instantiation}}
+S<5> s;
-template<typename T, T v> struct U {
+template<typename T, T v> struct U { // expected-note {{instantiation}}
decltype(v) n;
int &&r = v; // expected-warning {{binding reference member 'r' to a temporary value}} expected-note {{declared here}}
};
-U<const int, 6> u; // expected-note {{instantiation}}
+U<const int, 6> u;
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
index f804d4db1299d..580ef3151e5d3 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
@@ -9,7 +9,7 @@ template inline void X<int>::f(); // expected-error{{explicit instantiation cann
template<typename T>
struct Y {
- constexpr int f() { return 0; } // expected-warning{{C++1y}}
+ constexpr int f() { return 0; } // expected-warning{{C++14}}
};
template constexpr int Y<int>::f() const; // expected-error{{explicit instantiation cannot be 'constexpr'}}