aboutsummaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp2
-rw-r--r--test/CXX/basic/basic.types/p10.cpp2
-rw-r--r--test/CXX/class.derived/class.virtual/p2.cpp2
-rw-r--r--test/CXX/class/class.friend/p1.cpp4
-rw-r--r--test/CXX/conv/conv.mem/p4.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp6
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp4
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.fct.def/dcl.fct.def.default/p2.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp3
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp14
-rw-r--r--test/CXX/dcl.decl/dcl.init/p6.cpp6
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp3
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp20
-rw-r--r--test/CXX/drs/dr0xx.cpp6
-rw-r--r--test/CXX/drs/dr14xx.cpp148
-rw-r--r--test/CXX/drs/dr15xx.cpp83
-rw-r--r--test/CXX/drs/dr16xx.cpp26
-rw-r--r--test/CXX/drs/dr1748.cpp35
-rw-r--r--test/CXX/drs/dr17xx.cpp34
-rw-r--r--test/CXX/drs/dr19xx.cpp71
-rw-r--r--test/CXX/drs/dr2xx.cpp15
-rw-r--r--test/CXX/drs/dr3xx.cpp4
-rw-r--r--test/CXX/drs/dr412.cpp2
-rw-r--r--test/CXX/drs/dr4xx.cpp4
-rw-r--r--test/CXX/drs/dr7xx.cpp20
-rw-r--r--test/CXX/except/except.spec/p14-ir.cpp8
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.general/p8-0x.cpp4
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp8
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp7
-rw-r--r--test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp5
-rw-r--r--test/CXX/expr/p10-0x.cpp22
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp2
-rw-r--r--test/CXX/special/class.copy/p15-inclass.cpp12
-rw-r--r--test/CXX/special/class.dtor/p10-0x.cpp4
-rw-r--r--test/CXX/special/class.dtor/p9.cpp7
-rw-r--r--test/CXX/special/class.inhctor/p2.cpp2
-rw-r--r--test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp14
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp23
-rw-r--r--test/CXX/temp/temp.decls/temp.mem/p5.cpp4
-rw-r--r--test/CXX/temp/temp.param/p15-cxx0x.cpp2
-rw-r--r--test/CXX/temp/temp.res/temp.local/p3.cpp2
45 files changed, 580 insertions, 76 deletions
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
index b9e83988cfb8..d1562d4cd18b 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
@@ -108,7 +108,7 @@ namespace InhCtor {
// FIXME: Consider reusing the same diagnostic between dependent and non-dependent contexts
typedef int I;
struct UsingInt {
- using I::I; // expected-error {{'I' (aka 'int') is not a class, namespace, or scoped enumeration}}
+ using I::I; // expected-error {{'I' (aka 'int') is not a class, namespace, or enumeration}}
};
template<typename T> struct UsingIntTemplate {
using T::T; // expected-error {{type 'int' cannot be used prior to '::' because it has no members}}
diff --git a/test/CXX/basic/basic.types/p10.cpp b/test/CXX/basic/basic.types/p10.cpp
index 7b1af00b5d5c..19258f80f517 100644
--- a/test/CXX/basic/basic.types/p10.cpp
+++ b/test/CXX/basic/basic.types/p10.cpp
@@ -139,3 +139,5 @@ constexpr int f(ArrBad) { return 0; } // expected-error {{1st parameter type 'Ar
constexpr int arb(int n) {
int a[n]; // expected-error {{variable of non-literal type 'int [n]' cannot be defined in a constexpr function}}
}
+constexpr long Overflow[ // expected-error {{constexpr variable cannot have non-literal type 'long const[(1 << 30) << 2]'}}
+ (1 << 30) << 2]{}; // expected-warning {{requires 34 bits to represent}}
diff --git a/test/CXX/class.derived/class.virtual/p2.cpp b/test/CXX/class.derived/class.virtual/p2.cpp
index 64d93c883659..9e8d243fc3b0 100644
--- a/test/CXX/class.derived/class.virtual/p2.cpp
+++ b/test/CXX/class.derived/class.virtual/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -Wno-inaccessible-base %s
struct A {
virtual void f() = 0; // expected-note 2{{overridden virtual function}}
};
diff --git a/test/CXX/class/class.friend/p1.cpp b/test/CXX/class/class.friend/p1.cpp
index 07b3a101c2a9..96701b3b05a5 100644
--- a/test/CXX/class/class.friend/p1.cpp
+++ b/test/CXX/class/class.friend/p1.cpp
@@ -66,6 +66,10 @@ class A {
class facet;
friend class facet; // should not assert
class facet {};
+
+ friend int Unknown::thing(); // expected-error {{use of undeclared identifier}}
+ friend int friendfunc(), Unknown::thing(); // expected-error {{use of undeclared identifier}}
+ friend int friendfunc(), Unknown::thing() : 4; // expected-error {{use of undeclared identifier}}
};
A::UndeclaredSoFar y; // expected-error {{no type named 'UndeclaredSoFar' in 'A'}}
diff --git a/test/CXX/conv/conv.mem/p4.cpp b/test/CXX/conv/conv.mem/p4.cpp
index e0748d892362..1618ae125d2f 100644
--- a/test/CXX/conv/conv.mem/p4.cpp
+++ b/test/CXX/conv/conv.mem/p4.cpp
@@ -47,7 +47,7 @@ namespace test3 {
// Can't be virtual even if there's a non-virtual path.
namespace test4 {
struct A : Base {};
- struct Derived : Base, virtual A {};
+ struct Derived : Base, virtual A {}; // expected-warning {{direct base 'Base' is inaccessible due to ambiguity:\n struct test4::Derived -> struct Base\n struct test4::Derived -> struct test4::A -> struct Base}}
void test() {
int (Derived::*d) = data_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'Base' to pointer to member of derived class 'test4::Derived':}}
int (Derived::*m)() = method_ptr; // expected-error {{ambiguous conversion from pointer to member of base class 'Base' to pointer to member of derived class 'test4::Derived':}}
diff --git a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp
index 3c250f9d25dd..e713d72dc58f 100644
--- a/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp
+++ b/test/CXX/dcl.dcl/dcl.attr/dcl.align/p5.cpp
@@ -15,6 +15,12 @@ enum alignas(1) E1 {}; // expected-error {{requested alignment is less than mini
enum alignas(1) E2 : char {}; // ok
enum alignas(4) E3 { e3 = 0 }; // ok
enum alignas(4) E4 { e4 = 1ull << 33 }; // expected-error {{requested alignment is less than minimum alignment of 8 for type 'E4'}}
+enum alignas(8) E5 {};
+static_assert(alignof(E5) == 8, "");
+
+typedef __attribute__((aligned(16))) int IntAlign16;
+enum E6 : IntAlign16 {};
+static_assert(alignof(E6) == 4, "");
struct S1 {
alignas(8) int n;
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 1e3734e54311..3986dc9565c3 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
@@ -36,6 +36,8 @@ struct T : SS, NonLiteral {
constexpr int ImplicitlyVirtual() const { return 0; } // expected-error {{virtual function cannot be constexpr}}
+ virtual constexpr int OutOfLineVirtual() const; // expected-error {{virtual function cannot be constexpr}}
+
// - its return type shall be a literal type;
constexpr NonLiteral NonLiteralReturn() const { return {}; } // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}}
constexpr void VoidReturn() const { return; }
@@ -67,6 +69,8 @@ struct T : SS, NonLiteral {
// expected-error@-5 {{defaulted definition of copy assignment operator is not constexpr}}
#endif
};
+
+constexpr int T::OutOfLineVirtual() const { return 0; }
#ifdef CXX1Y
struct T2 {
int n = 0;
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 5f102e7458ea..0aaedcc07696 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'}} expected-note {{add an explicit initializer to initialize 'ni1'}}
+constexpr int ni1; // expected-error {{default initialization of an object of const type 'const int'}}
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' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'origin'}}
+constexpr pixel origin; // expected-error {{default initialization of an object of const type 'const pixel' without a user-provided default constructor}}
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 81876192caa7..5cf281c18537 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' without a user-provided default constructor}} expected-note{{add an explicit initializer to initialize 's3d'}}
+constexpr S3 s3d; // expected-error {{default initialization of an object of const type 'const S3' without a user-provided default constructor}}
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' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'b'}}
+ const B b; // expected-error {{default initialization of an object of const type 'const PR13492::B' without a user-provided default constructor}}
}
}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
index 42dee92b3ca3..48c5b23207c5 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
@@ -57,6 +57,9 @@ void float_to_int() {
Agg<char> ce1 = { Convert<float>(1.0) }; // expected-error {{type 'float' cannot be narrowed to 'char'}} expected-note {{silence}}
Agg<char> ce2 = { ConvertVar<double>() }; // expected-error {{type 'double' cannot be narrowed to 'char'}} expected-note {{silence}}
+
+ bool b{1.0}; // expected-error {{type 'double' cannot be narrowed to 'bool'}} expected-note {{silence}}
+ Agg<bool> ab = {0.0}; // expected-error {{type 'double' cannot be narrowed to 'bool'}} expected-note {{silence}}
}
// * from long double to double or float, or from double to float, except where
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
index fdfa6781fe27..a4d7d63754b9 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp
@@ -123,7 +123,7 @@ namespace std_example_2 {
const double& rcd2 = 2;
double&& rrd = 2;
const volatile int cvi = 1;
- const int& r2 = cvi; // expected-error{{binding of reference to type 'const int' to a value of type 'const volatile int' drops qualifiers}}
+ const int& r2 = cvi; // expected-error{{binding value of type 'const volatile int' to reference to type 'const int' drops 'volatile' qualifier}}
double d;
double&& rrd2 = d; // expected-error{{rvalue reference to type 'double' cannot bind to lvalue of type 'double'}}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
index fee5f96c389f..cb62874b40cd 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-var.cpp
@@ -52,8 +52,8 @@ void bind_lvalue_to_lvalue(Base b, Derived d,
Base &br2 = d;
Derived &dr1 = d;
Derived &dr2 = b; // expected-error{{non-const lvalue reference to type 'Derived' cannot bind to a value of unrelated type 'Base'}}
- Base &br3 = bc; // expected-error{{drops qualifiers}}
- Base &br4 = dc; // expected-error{{drops qualifiers}}
+ Base &br3 = bc; // expected-error{{drops 'const' qualifier}}
+ Base &br4 = dc; // expected-error{{drops 'const' qualifier}}
Base &br5 = diamond; // expected-error{{ambiguous conversion from derived class 'Diamond' to base class 'Base':}}
int &ir = i;
long &lr = i; // expected-error{{non-const lvalue reference to type 'long' cannot bind to a value of unrelated type 'int'}}
@@ -64,10 +64,10 @@ void bind_lvalue_quals(volatile Base b, volatile Derived d,
volatile const int ivc) {
volatile Base &bvr1 = b;
volatile Base &bvr2 = d;
- volatile Base &bvr3 = bvc; // expected-error{{binding of reference to type 'volatile Base' to a value of type 'const volatile Base' drops qualifiers}}
- volatile Base &bvr4 = dvc; // expected-error{{binding of reference to type 'volatile Base' to a value of type 'const volatile Derived' drops qualifiers}}
+ volatile Base &bvr3 = bvc; // expected-error{{binding value of type 'const volatile Base' to reference to type 'volatile Base' drops 'const' qualifier}}
+ volatile Base &bvr4 = dvc; // expected-error{{binding value of type 'const volatile Derived' to reference to type 'volatile Base' drops 'const' qualifier}}
- volatile int &ir = ivc; // expected-error{{binding of reference to type 'volatile int' to a value of type 'const volatile int' drops qualifiers}}
+ volatile int &ir = ivc; // expected-error{{binding value of type 'const volatile int' to reference to type 'volatile int' drops 'const' qualifier}}
const volatile Base &bcvr1 = b;
const volatile Base &bcvr2 = d;
@@ -118,8 +118,8 @@ void bind_const_lvalue_to_rvalue() {
const Base &br3 = create<const Base>();
const Base &br4 = create<const Derived>();
- const Base &br5 = create<const volatile Base>(); // expected-error{{binding of reference to type 'const Base' to a value of type 'const volatile Base' drops qualifiers}}
- const Base &br6 = create<const volatile Derived>(); // expected-error{{binding of reference to type 'const Base' to a value of type 'const volatile Derived' drops qualifiers}}
+ const Base &br5 = create<const volatile Base>(); // expected-error{{binding value of type 'const volatile Base' to reference to type 'const Base' drops 'volatile' qualifier}}
+ const Base &br6 = create<const volatile Derived>(); // expected-error{{binding value of type 'const volatile Derived' to reference to type 'const Base' drops 'volatile' qualifier}}
const int &ir = create<int>();
}
diff --git a/test/CXX/dcl.decl/dcl.init/p6.cpp b/test/CXX/dcl.decl/dcl.init/p6.cpp
index 76b7e7625d57..e404a1ebc19e 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' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'x1'}}
+ const NoUserDefault x1; // expected-error{{default initialization of an object of const type 'const NoUserDefault' without a user-provided default constructor}}
const HasUserDefault x2;
- const int x3; // expected-error{{default initialization of an object of const type 'const int'}} expected-note{{add an explicit initializer to initialize 'x3'}}
+ const int x3; // expected-error{{default initialization of an object of const type 'const int'}}
}
// 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' without a user-provided default constructor}} expected-note {{add an explicit initializer to initialize 'foo'}}
+const struct s0 s1::foo; // expected-error{{default initialization of an object of const type 'const struct s0' without a user-provided default constructor}}
template<typename T>
struct s2 {
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
index e03c2164bae1..11c17f32728a 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p3.cpp
@@ -14,3 +14,6 @@ struct X0 {
void mem8(int (*fp)(int) = (int (*)(int = 17))0); // expected-error{{default arguments can only be specified for parameters in a function declaration}}
};
+
+template <typename... Ts>
+void defaultpack(Ts... = 0) {} // expected-error{{parameter pack cannot have a default argument}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
index f3dec52f63b3..a5ac85cb6f3a 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp
@@ -6,6 +6,7 @@ void f0(int i, int j = 2, int k);
void f0(int i, int j, int k);
void f0(int i = 1, // expected-note{{previous definition}}
int j, int k);
+void f0(int i, int j, int k); // want 2 decls before next default arg
void f0(int i, int j, int k);
namespace N0 {
@@ -53,3 +54,22 @@ namespace N1 {
f2(6); // okay
}
}
+
+
+namespace PR18432 {
+
+struct A {
+ struct B {
+ static void Foo (int = 0);
+ };
+
+ // should not hide default args
+ friend void B::Foo (int);
+};
+
+void Test ()
+{
+ A::B::Foo ();
+}
+
+} // namespace
diff --git a/test/CXX/drs/dr0xx.cpp b/test/CXX/drs/dr0xx.cpp
index 5b34cc3380c1..dd0d4d17a8fe 100644
--- a/test/CXX/drs/dr0xx.cpp
+++ b/test/CXX/drs/dr0xx.cpp
@@ -425,7 +425,7 @@ namespace dr39 { // dr39: no
using V::z;
float &z(float);
};
- struct C : A, B, virtual V {} c;
+ struct C : A, B, virtual V {} c; // expected-warning {{direct base 'dr39::example2::A' is inaccessible due to ambiguity:\n struct dr39::example2::C -> struct dr39::example2::A\n struct dr39::example2::C -> struct dr39::example2::B -> struct dr39::example2::A}}
int &x = c.x(0); // expected-error {{found in multiple base classes}}
// FIXME: This is valid, because we find the same static data member either way.
int &y = c.y(0); // expected-error {{found in multiple base classes}}
@@ -864,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}} expected-note{{add an explicit initializer to initialize 'k'}}
+ const int k; // expected-error {{default initialization of an object of const}}
}
// dr79: na
@@ -994,7 +994,7 @@ namespace dr91 { // dr91: yes
int k = f(U());
}
-namespace dr92 { // dr92: yes
+namespace dr92 { // FIXME: Issue is still open.
void f() throw(int, float);
void (*p)() throw(int) = &f; // expected-error {{target exception specification is not superset of source}}
void (*q)() throw(int);
diff --git a/test/CXX/drs/dr14xx.cpp b/test/CXX/drs/dr14xx.cpp
index e93192427268..9491f7da1476 100644
--- a/test/CXX/drs/dr14xx.cpp
+++ b/test/CXX/drs/dr14xx.cpp
@@ -195,3 +195,151 @@ namespace dr1460 { // dr1460: 3.5
}
#endif
}
+
+#if __cplusplus >= 201103L
+namespace std {
+ typedef decltype(sizeof(int)) size_t;
+
+ // libc++'s implementation
+ template <class _E>
+ class initializer_list
+ {
+ const _E* __begin_;
+ size_t __size_;
+
+ initializer_list(const _E* __b, size_t __s)
+ : __begin_(__b), __size_(__s) {}
+
+ public:
+ typedef _E value_type;
+ typedef const _E& reference;
+ typedef const _E& const_reference;
+ typedef size_t size_type;
+
+ typedef const _E* iterator;
+ typedef const _E* const_iterator;
+
+ initializer_list() : __begin_(nullptr), __size_(0) {}
+
+ size_t size() const {return __size_;}
+ const _E* begin() const {return __begin_;}
+ const _E* end() const {return __begin_ + __size_;}
+ };
+} // std
+
+namespace dr1467 { // dr1467: 3.7 c++11
+ // List-initialization of aggregate from same-type object
+
+ namespace basic0 {
+ struct S {
+ int i = 42;
+ };
+
+ S a;
+ S b(a);
+ S c{a};
+
+ struct SS : public S { } x;
+ S y(x);
+ S z{x};
+ } // basic0
+
+ namespace basic1 {
+ struct S {
+ int i{42};
+ };
+
+ S a;
+ S b(a);
+ S c{a};
+
+ struct SS : public S { } x;
+ S y(x);
+ S z{x};
+ } // basic1
+
+ namespace basic2 {
+ struct S {
+ int i = {42};
+ };
+
+ S a;
+ S b(a);
+ S c{a};
+
+ struct SS : public S { } x;
+ S y(x);
+ S z{x};
+ } // basic2
+
+ namespace dr_example {
+ struct OK {
+ OK() = default;
+ OK(const OK&) = default;
+ OK(int) { }
+ };
+
+ OK ok;
+ OK ok2{ok};
+
+ struct X {
+ X() = default;
+ X(const X&) = default;
+ };
+
+ X x;
+ X x2{x};
+ } // dr_example
+
+ namespace nonaggregate {
+ struct NonAggregate {
+ NonAggregate() {}
+ };
+
+ struct WantsIt {
+ WantsIt(NonAggregate);
+ };
+
+ void f(NonAggregate);
+ void f(WantsIt);
+
+ void test1() {
+ NonAggregate n;
+ f({n});
+ }
+
+ void test2() {
+ NonAggregate x;
+ NonAggregate y{x};
+ NonAggregate z{{x}};
+ }
+ } // nonaggregate
+
+ namespace SelfInitIsNotListInit {
+ struct S {
+ S();
+ explicit S(S &);
+ S(const S &);
+ };
+ S s1;
+ S s2 = {s1}; // ok, not list-initialization so we pick the non-explicit constructor
+ }
+
+ struct NestedInit { int a, b, c; };
+ NestedInit ni[1] = {{NestedInit{1, 2, 3}}};
+
+ namespace NestedInit2 {
+ struct Pair { int a, b; };
+ struct TwoPairs { TwoPairs(Pair, Pair); };
+ struct Value { Value(Pair); Value(TwoPairs); };
+ void f() { Value{{{1,2},{3,4}}}; }
+ }
+} // dr1467
+
+namespace dr1490 { // dr1490: 3.7 c++11
+ // List-initialization from a string literal
+
+ char s[4]{"abc"}; // Ok
+ std::initializer_list<char>{"abc"}; // expected-error {{expected unqualified-id}}}
+} // dr190
+#endif
diff --git a/test/CXX/drs/dr15xx.cpp b/test/CXX/drs/dr15xx.cpp
index d7c2b9225c4d..d35583ff9f4e 100644
--- a/test/CXX/drs/dr15xx.cpp
+++ b/test/CXX/drs/dr15xx.cpp
@@ -3,7 +3,9 @@
// 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 dr1550 { // dr1550: yes
int f(bool b, int n) {
@@ -19,3 +21,84 @@ namespace dr1560 { // dr1560: 3.5
const X &get();
const X &x = true ? get() : throw 0;
}
+
+#if __cplusplus >= 201103L
+namespace std {
+ typedef decltype(sizeof(int)) size_t;
+
+ // libc++'s implementation
+ template <class _E>
+ class initializer_list
+ {
+ const _E* __begin_;
+ size_t __size_;
+
+ initializer_list(const _E* __b, size_t __s)
+ : __begin_(__b), __size_(__s) {}
+
+ public:
+ typedef _E value_type;
+ typedef const _E& reference;
+ typedef const _E& const_reference;
+ typedef size_t size_type;
+
+ typedef const _E* iterator;
+ typedef const _E* const_iterator;
+
+ initializer_list() : __begin_(nullptr), __size_(0) {}
+
+ size_t size() const {return __size_;}
+ const _E* begin() const {return __begin_;}
+ const _E* end() const {return __begin_ + __size_;}
+ };
+
+ template < class _T1, class _T2 > struct pair { _T2 second; };
+
+ template<typename T> struct basic_string {
+ basic_string(const T* x) {}
+ ~basic_string() {};
+ };
+ typedef basic_string<char> string;
+
+} // std
+
+namespace dr1589 { // dr1589: 3.7 c++11
+ // Ambiguous ranking of list-initialization sequences
+
+ void f0(long, int=0); // Would makes selection of #0 ambiguous
+ void f0(long); // #0
+ void f0(std::initializer_list<int>); // #00
+ void g0() { f0({1L}); } // chooses #00
+
+ void f1(int, int=0); // Would make selection of #1 ambiguous
+ void f1(int); // #1
+ void f1(std::initializer_list<long>); // #2
+ void g1() { f1({42}); } // chooses #2
+
+ void f2(std::pair<const char*, const char*>, int = 0); // Would makes selection of #3 ambiguous
+ void f2(std::pair<const char*, const char*>); // #3
+ void f2(std::initializer_list<std::string>); // #4
+ void g2() { f2({"foo","bar"}); } // chooses #4
+
+ namespace with_error {
+ void f0(long); // #0 expected-note {{candidate function}}
+ void f0(std::initializer_list<int>); // #00 expected-note {{candidate function}}
+ void f0(std::initializer_list<int>, int = 0); // Makes selection of #00 ambiguous \
+ // expected-note {{candidate function}}
+ void g0() { f0({1L}); } // chooses #00 expected-error{{call to 'f0' is ambiguous}}
+
+ void f1(int); // #1 expected-note {{candidate function}}
+ void f1(std::initializer_list<long>); // #2 expected-note {{candidate function}}
+ void f1(std::initializer_list<long>, int = 0); // Makes selection of #00 ambiguous \
+ // expected-note {{candidate function}}
+ void g1() { f1({42}); } // chooses #2 expected-error{{call to 'f1' is ambiguous}}
+
+ void f2(std::pair<const char*, const char*>); // #3 TODO: expected- note {{candidate function}}
+ void f2(std::initializer_list<std::string>); // #4 expected-note {{candidate function}}
+ void f2(std::initializer_list<std::string>, int = 0); // Makes selection of #00 ambiguous \
+ // expected-note {{candidate function}}
+ void g2() { f2({"foo","bar"}); } // chooses #4 expected-error{{call to 'f2' is ambiguous}}
+ }
+
+} // dr1589
+#endif
diff --git a/test/CXX/drs/dr16xx.cpp b/test/CXX/drs/dr16xx.cpp
index 62040f1a130a..ddb7d16869ba 100644
--- a/test/CXX/drs/dr16xx.cpp
+++ b/test/CXX/drs/dr16xx.cpp
@@ -17,3 +17,29 @@ namespace dr1684 { // dr1684: 3.6
constexpr int f(NonLiteral) { return 0; } // expected-error {{not a literal type}}
#endif
}
+
+#if __cplusplus >= 201103L
+namespace dr1631 { // dr1631: 3.7 c++11
+ // Incorrect overload resolution for single-element initializer-list
+
+ struct A { int a[1]; };
+ struct B { B(int); };
+ void f(B, int);
+ void f(B, int, int = 0);
+ void f(int, A);
+
+ void test() {
+ f({0}, {{1}}); // expected-warning {{braces around scalar init}}
+ }
+
+ namespace with_error {
+ void f(B, int); // TODO: expected- note {{candidate function}}
+ void f(int, A); // expected-note {{candidate function}}
+ void f(int, A, int = 0); // expected-note {{candidate function}}
+
+ void test() {
+ f({0}, {{1}}); // expected-error{{call to 'f' is ambiguous}}
+ }
+ }
+} // dr1631
+#endif
diff --git a/test/CXX/drs/dr1748.cpp b/test/CXX/drs/dr1748.cpp
new file mode 100644
index 000000000000..7e04f402d266
--- /dev/null
+++ b/test/CXX/drs/dr1748.cpp
@@ -0,0 +1,35 @@
+// RUN: %clang_cc1 -std=c++98 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
+// RUN: %clang_cc1 -std=c++14 %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
+// RUN: %clang_cc1 -std=c++1z %s -triple x86_64-linux-gnu -emit-llvm -o - -fexceptions -fcxx-exceptions -pedantic-errors | FileCheck %s
+
+// dr1748: 3.7
+
+// FIXME: __SIZE_TYPE__ expands to 'long long' on some targets.
+__extension__ typedef __SIZE_TYPE__ size_t;
+
+void *operator new(size_t, void *);
+void *operator new[](size_t, void *);
+
+struct X { X(); };
+
+// The reserved placement allocation functions get inlined
+// even if we can't see their definitions. They do not
+// perform a null check.
+
+// CHECK-LABEL: define {{.*}} @_Z1fPv(
+// CHECK-NOT: call
+// CHECK-NOT: icmp{{.*}} null
+// CHECK-NOT: br i1
+// CHECK: call void @_ZN1XC1Ev(
+// CHECK: }
+X *f(void *p) { return new (p) X; }
+
+// CHECK-LABEL: define {{.*}} @_Z1gPv(
+// CHECK-NOT: call
+// CHECK-NOT: icmp{{.*}} null
+// CHECK-NOT: br i1
+// CHECK: call void @_ZN1XC1Ev(
+// CHECK: br i1
+// CHECK: }
+X *g(void *p) { return new (p) X[5]; }
diff --git a/test/CXX/drs/dr17xx.cpp b/test/CXX/drs/dr17xx.cpp
new file mode 100644
index 000000000000..1ab8c40d3972
--- /dev/null
+++ b/test/CXX/drs/dr17xx.cpp
@@ -0,0 +1,34 @@
+// 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
+
+// expected-no-diagnostics
+
+#if __cplusplus >= 201103L
+namespace dr1756 { // dr1756: 3.7 c++11
+ // Direct-list-initialization of a non-class object
+
+ int a{0};
+
+ struct X { operator int(); } x;
+ int b{x};
+} // dr1756
+
+namespace dr1758 { // dr1758: 3.7 c++11
+ // Explicit conversion in copy/move list initialization
+
+ struct X { X(); };
+ struct Y { explicit operator X(); } y;
+ X x{y};
+
+ struct A {
+ A() {}
+ A(const A &) {}
+ };
+ struct B {
+ operator A() { return A(); }
+ } b;
+ A a{b};
+} // dr1758
+#endif
diff --git a/test/CXX/drs/dr19xx.cpp b/test/CXX/drs/dr19xx.cpp
new file mode 100644
index 000000000000..9c2d3e7c1770
--- /dev/null
+++ b/test/CXX/drs/dr19xx.cpp
@@ -0,0 +1,71 @@
+// 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 dr1902 { // dr1902: 3.7
+ struct A {};
+ struct B {
+ B(A);
+#if __cplusplus >= 201103L
+ // expected-note@-2 {{candidate}}
+#endif
+
+ B() = delete;
+#if __cplusplus < 201103L
+ // expected-error@-2 {{extension}}
+#endif
+
+ B(const B&) // expected-note {{deleted here}}
+#if __cplusplus >= 201103L
+ // expected-note@-2 {{candidate}}
+#else
+ // expected-error@+2 {{extension}}
+#endif
+ = delete;
+
+ operator A();
+ };
+
+ extern B b1;
+ B b2(b1); // expected-error {{call to deleted}}
+
+#if __cplusplus >= 201103L
+ // This is ambiguous, even though calling the B(const B&) constructor would
+ // both directly and indirectly call a deleted function.
+ B b({}); // expected-error {{ambiguous}}
+#endif
+}
+
+#if __cplusplus >= 201103L
+namespace dr1940 { // dr1940: yes
+static union {
+ static_assert(true, ""); // ok
+ static_assert(false, ""); // expected-error {{static_assert failed}}
+};
+}
+#endif
+
+#if __cplusplus >= 201402L
+namespace dr1947 { // dr1947: yes
+unsigned o = 0'01; // ok
+unsigned b = 0b'01; // expected-error {{invalid digit 'b' in octal constant}}
+unsigned x = 0x'01; // expected-error {{invalid suffix 'x'01' on integer constant}}
+}
+#endif
+
+#if __cplusplus >= 201103L
+// dr1948: yes
+// FIXME: This diagnostic could be improved.
+void *operator new(__SIZE_TYPE__) noexcept { return nullptr; } // expected-error{{exception specification in declaration does not match previous declaration}}
+#endif
+
+#if __cplusplus >= 201103L
+namespace dr1968 { // dr1968: yes
+static_assert(&typeid(int) == &typeid(int), ""); // expected-error{{not an integral constant expression}}
+}
+#endif
+
+// dr1994: dup 529
diff --git a/test/CXX/drs/dr2xx.cpp b/test/CXX/drs/dr2xx.cpp
index bb1f13ac64ee..25c853590ae6 100644
--- a/test/CXX/drs/dr2xx.cpp
+++ b/test/CXX/drs/dr2xx.cpp
@@ -999,15 +999,20 @@ namespace dr294 { // dr294: no
}
}
-namespace dr295 { // dr295: no
+namespace dr295 { // dr295: 3.7
typedef int f();
- // FIXME: This warning is incorrect.
- const f g; // expected-warning {{unspecified behavior}}
- const f &r = g; // expected-warning {{unspecified behavior}}
+ const f g; // expected-warning {{'const' qualifier on function type 'f' (aka 'int ()') has no effect}}
+ f &r = g;
template<typename T> struct X {
const T &f;
};
- X<f> x = {g}; // FIXME: expected-error {{drops qualifiers}}
+ X<f> x = {g};
+
+ typedef int U();
+ typedef const U U; // expected-warning {{'const' qualifier on function type 'U' (aka 'int ()') has no effect}}
+
+ typedef int (*V)();
+ typedef volatile U *V; // expected-warning {{'volatile' qualifier on function type 'U' (aka 'int ()') has no effect}}
}
namespace dr296 { // dr296: yes
diff --git a/test/CXX/drs/dr3xx.cpp b/test/CXX/drs/dr3xx.cpp
index cea4d64e7eb6..5ac4f013b7fd 100644
--- a/test/CXX/drs/dr3xx.cpp
+++ b/test/CXX/drs/dr3xx.cpp
@@ -170,9 +170,9 @@ namespace dr308 { // dr308: yes
void f() {
try {
throw D();
- } catch (const A&) {
+ } catch (const A&) { // expected-note {{for type 'const dr308::A &'}}
// unreachable
- } catch (const B&) {
+ } catch (const B&) { // expected-warning {{exception of type 'const dr308::B &' will be caught by earlier handler}}
// get here instead
}
}
diff --git a/test/CXX/drs/dr412.cpp b/test/CXX/drs/dr412.cpp
index 39cdd6182d20..27bc7e5cf94e 100644
--- a/test/CXX/drs/dr412.cpp
+++ b/test/CXX/drs/dr412.cpp
@@ -15,7 +15,7 @@ inline void* operator new(size_t) BAD_ALLOC; // expected-error {{cannot be decla
inline void* operator new[](size_t) BAD_ALLOC; // expected-error {{cannot be declared 'inline'}}
inline void operator delete(void*) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
inline void operator delete[](void*) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
-#if __cplusplus >= 201402L
+#ifdef __cpp_sized_deallocation
inline void operator delete(void*, size_t) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
inline void operator delete[](void*, size_t) NOEXCEPT; // expected-error {{cannot be declared 'inline'}}
#endif
diff --git a/test/CXX/drs/dr4xx.cpp b/test/CXX/drs/dr4xx.cpp
index 42c6774dd186..bbe5ee6faa59 100644
--- a/test/CXX/drs/dr4xx.cpp
+++ b/test/CXX/drs/dr4xx.cpp
@@ -1202,9 +1202,9 @@ namespace dr497 { // dr497: yes
struct S {
mutable int i;
};
- const S cs; // expected-error {{default initialization}} expected-note {{add an explicit initializer}}
+ const S cs; // expected-error {{default initialization}}
int S::*pm = &S::i;
- cs.*pm = 88;
+ cs.*pm = 88; // expected-error {{not assignable}}
}
void after() {
diff --git a/test/CXX/drs/dr7xx.cpp b/test/CXX/drs/dr7xx.cpp
new file mode 100644
index 000000000000..fe4a2dc5ee4a
--- /dev/null
+++ b/test/CXX/drs/dr7xx.cpp
@@ -0,0 +1,20 @@
+// 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 dr777 { // dr777: 3.7
+#if __cplusplus >= 201103L
+template <typename... T>
+void f(int i = 0, T ...args) {}
+void ff() { f(); }
+
+template <typename... T>
+void g(int i = 0, T ...args, T ...args2) {}
+
+template <typename... T>
+void h(int i = 0, T ...args, int j = 1) {}
+#endif
+}
+
+// expected-no-diagnostics
diff --git a/test/CXX/except/except.spec/p14-ir.cpp b/test/CXX/except/except.spec/p14-ir.cpp
index e3b15e5bde9a..af1d9a442505 100644
--- a/test/CXX/except/except.spec/p14-ir.cpp
+++ b/test/CXX/except/except.spec/p14-ir.cpp
@@ -66,16 +66,16 @@ void test() {
// CHECK-NEXT: ret void
X9();
+ // CHECK: define linkonce_odr void @_ZN2X8C2Ev(%struct.X8* %this) unnamed_addr
+ // CHECK: call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
+ // CHECK-NEXT: ret void
+
// CHECK: define linkonce_odr void @_ZN2X9C2Ev(%struct.X9* %this) unnamed_addr
// CHECK: call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
// FIXME: and here:
// CHECK-NEXT: bitcast
// CHECK-NEXT: call void @_ZN2X7C2Ev({{.*}})
// CHECK: ret void
-
- // CHECK: define linkonce_odr void @_ZN2X8C2Ev(%struct.X8* %this) unnamed_addr
- // CHECK: call void @_ZN2X6C2Ev({{.*}}) [[NUW]]
- // CHECK-NEXT: ret void
}
// CHECK: attributes [[NUW]] = { nounwind{{.*}} }
diff --git a/test/CXX/expr/expr.prim/expr.prim.general/p8-0x.cpp b/test/CXX/expr/expr.prim/expr.prim.general/p8-0x.cpp
index 5b3a004056b5..b5cd98828cc9 100644
--- a/test/CXX/expr/expr.prim/expr.prim.general/p8-0x.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.general/p8-0x.cpp
@@ -47,8 +47,8 @@ namespace PR10127 {
decltype()::middle::fail g; // expected-error{{expected expression}}
decltype(int()) h;
- decltype(int())::PR10127::outer i; // expected-error{{'decltype(int())' (aka 'int') is not a class, namespace, or scoped enumeration}}
- decltype(int())::global j; // expected-error{{'decltype(int())' (aka 'int') is not a class, namespace, or scoped enumeration}}
+ decltype(int())::PR10127::outer i; // expected-error{{'decltype(int())' (aka 'int') is not a class, namespace, or enumeration}}
+ decltype(int())::global j; // expected-error{{'decltype(int())' (aka 'int') is not a class, namespace, or enumeration}}
outer::middle k = decltype(outer())::middle();
outer::middle::inner l = decltype(outer())::middle::inner();
diff --git a/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp b/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp
index 0cf01ade4313..94f8111015aa 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p16.cpp
@@ -24,16 +24,16 @@ void test_capture(X x) {
int a;
[=]{
[&] {
- int &x = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
- int &x2 = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
+ int &x = a; // expected-error{{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
+ int &x2 = a; // expected-error{{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
}();
}();
[=]{
[&a] {
[&] {
- int &x = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
- int &x2 = a; // expected-error{{binding of reference to type 'int' to a value of type 'const int' drops qualifiers}}
+ int &x = a; // expected-error{{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
+ int &x2 = a; // expected-error{{binding value of type 'const int' to reference to type 'int' drops 'const' qualifier}}
}();
}();
}();
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 647c76d604e4..872248e77e6a 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/p2.cpp
@@ -24,7 +24,6 @@ template<typename T>
struct Boom {
Boom(const Boom&) {
T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} \
- // expected-error{{cannot initialize a variable of type 'float *' with an rvalue of type 'int'}} \
// expected-error{{cannot initialize a variable of type 'double *' with an rvalue of type 'int'}}
}
void tickle() const;
@@ -34,9 +33,11 @@ void odr_used(P &p, Boom<int> boom_int, Boom<float> boom_float,
Boom<double> boom_double) {
const std::type_info &ti1
= typeid([=,&p]() -> P& { boom_int.tickle(); return p; }()); // expected-note{{in instantiation of member function 'Boom<int>::Boom' requested here}}
+ // This does not cause the instantiation of the Boom copy constructor,
+ // because the copy-initialization of the capture of boom_float occurs in an
+ // unevaluated operand.
const std::type_info &ti2
- = typeid([=]() -> int { boom_float.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}} \
- // expected-note{{in instantiation of member function 'Boom<float>::Boom' requested here}}
+ = typeid([=]() -> int { boom_float.tickle(); return 0; }()); // expected-error{{lambda expression in an unevaluated operand}}
auto foo = [=]() -> int { boom_double.tickle(); return 0; }; // expected-note{{in instantiation of member function 'Boom<double>::Boom' requested here}}
}
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 90cbf02b2a6a..c18bb7d1921b 100644
--- a/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
+++ b/test/CXX/expr/expr.prim/expr.prim.lambda/templates.cpp
@@ -69,8 +69,7 @@ namespace p2 {
template<typename T>
struct Boom {
Boom(const Boom&) {
- T* x = 1; // expected-error{{cannot initialize a variable of type 'int *' with an rvalue of type 'int'}} \
- // expected-error{{cannot initialize a variable of type 'float *' with an rvalue of type 'int'}}
+ T* x = 1; // expected-error{{cannot initialize a variable of type 'float *' with an rvalue of type 'int'}}
}
void tickle() const;
};
@@ -79,7 +78,7 @@ namespace p2 {
void odr_used(R &r, Boom<T> boom) {
const std::type_info &ti
= typeid([=,&r] () -> R& { // expected-error{{lambda expression in an unevaluated operand}}
- boom.tickle(); // expected-note{{in instantiation of member function}}
+ boom.tickle();
return r;
}());
}
diff --git a/test/CXX/expr/p10-0x.cpp b/test/CXX/expr/p10-0x.cpp
index 564df8843a57..a42986c85fef 100644
--- a/test/CXX/expr/p10-0x.cpp
+++ b/test/CXX/expr/p10-0x.cpp
@@ -10,26 +10,26 @@ volatile int& refcall();
// CHECK: define void @_Z2f1PViPV1S
void f1(volatile int *x, volatile S* s) {
// We should perform the load in these cases.
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
(*x);
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
__extension__ g1;
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
s->a;
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
g2.a;
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
s->*(&S::a);
- // CHECK: load volatile i32*
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
+ // CHECK: load volatile i32, i32*
x[0], 1 ? x[0] : *x;
- // CHECK: load volatile i32*
- // CHECK: load volatile i32*
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
+ // CHECK: load volatile i32, i32*
+ // CHECK: load volatile i32, i32*
*x ?: *x;
- // CHECK: load volatile i32*
+ // CHECK: load volatile i32, i32*
({ *x; });
// CHECK-NOT: load volatile
diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
index a10d139fe3cd..588778c400b3 100644
--- a/test/CXX/special/class.copy/implicit-move.cpp
+++ b/test/CXX/special/class.copy/implicit-move.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -Wno-inaccessible-base %s
// Tests for implicit (non-)declaration of move constructor and
// assignment: p9, p11, p20, p23.
diff --git a/test/CXX/special/class.copy/p15-inclass.cpp b/test/CXX/special/class.copy/p15-inclass.cpp
index 6cfa94fafad5..7e716fd6c92f 100644
--- a/test/CXX/special/class.copy/p15-inclass.cpp
+++ b/test/CXX/special/class.copy/p15-inclass.cpp
@@ -20,21 +20,21 @@ namespace PR11418 {
X x3(static_cast<X&&>(x));
}
- // CHECK: define linkonce_odr void @_ZN7PR114181XC2EOS0_
+ // CHECK: define linkonce_odr void @_ZN7PR114181XC2ERKS0_
// CHECK-NOT: 17
- // CHECK: call void @_ZN7PR114186NonPODC1EOS0_
+ // CHECK: call void @_ZN7PR114186NonPODC1ERKS0_
// CHECK-NOT: 17
- // CHECK: load i32*
+ // CHECK: load i32, i32*
// CHECK-NOT: 17
// CHECK: store i32
// CHECK-NOT: 17
// CHECK: ret
- // CHECK: define linkonce_odr void @_ZN7PR114181XC2ERKS0_
+ // CHECK: define linkonce_odr void @_ZN7PR114181XC2EOS0_
// CHECK-NOT: 17
- // CHECK: call void @_ZN7PR114186NonPODC1ERKS0_
+ // CHECK: call void @_ZN7PR114186NonPODC1EOS0_
// CHECK-NOT: 17
- // CHECK: load i32*
+ // CHECK: load i32, i32*
// CHECK-NOT: 17
// CHECK: store i32
// CHECK-NOT: 17
diff --git a/test/CXX/special/class.dtor/p10-0x.cpp b/test/CXX/special/class.dtor/p10-0x.cpp
index 029cbd6cebb5..3b8a0ad4d6a7 100644
--- a/test/CXX/special/class.dtor/p10-0x.cpp
+++ b/test/CXX/special/class.dtor/p10-0x.cpp
@@ -27,9 +27,9 @@ void a(const A *x, int i, int *pi) {
y->~decltype(A())(); // expected-error{{use of undeclared identifier 'y'}}
typedef int *intp;
- i->~decltype(int())(); // expected-error{{member reference type 'int' is not a pointer; maybe you meant to use '.'?}}
+ i->~decltype(int())(); // expected-error{{member reference type 'int' is not a pointer; did you mean to use '.'?}}
i.~decltype(int())();
- i->~decltype(intp())(); // expected-error{{member reference type 'int' is not a pointer; maybe you meant to use '.'?}} \
+ i->~decltype(intp())(); // expected-error{{member reference type 'int' is not a pointer; did you mean to use '.'?}} \
expected-error{{the type of object expression ('int') does not match the type being destroyed ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}}
i.~decltype(intp())(); // expected-error{{the type of object expression ('int') does not match the type being destroyed ('decltype(intp())' (aka 'int *')) in pseudo-destructor expression}}
pi->~decltype(int())();
diff --git a/test/CXX/special/class.dtor/p9.cpp b/test/CXX/special/class.dtor/p9.cpp
index a03fcdb24952..42a4236a4a07 100644
--- a/test/CXX/special/class.dtor/p9.cpp
+++ b/test/CXX/special/class.dtor/p9.cpp
@@ -89,4 +89,11 @@ namespace test3 {
virtual ~B() {}
static void operator delete(void*);
};
+
+ void f() {
+#ifdef MSABI
+ // expected-note@+2 {{implicit default constructor for 'test3::B' first required here}}
+#endif
+ B use_vtable;
+ }
}
diff --git a/test/CXX/special/class.inhctor/p2.cpp b/test/CXX/special/class.inhctor/p2.cpp
index e6abd6840e46..d1c16ff886c3 100644
--- a/test/CXX/special/class.inhctor/p2.cpp
+++ b/test/CXX/special/class.inhctor/p2.cpp
@@ -96,7 +96,7 @@ struct TemplateCtors {
template<typename T = int> TemplateCtors(int, int = 0, int = 0); // expected-note {{inherited from here}}
};
-struct UsingTemplateCtors : TemplateCtors {
+struct UsingTemplateCtors : TemplateCtors { // expected-note 2{{candidate is the implicit}}
using TemplateCtors::TemplateCtors; // expected-note 4{{here}} expected-note {{candidate}}
constexpr UsingTemplateCtors(X<0>, X<0>) {}
diff --git a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
index c23cd28f3137..7d689ae0b1c1 100644
--- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
+++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -50,6 +50,18 @@ namespace X {
struct NoEndADL {
null_t alt_begin();
};
+
+ struct C {
+ C();
+ struct It {
+ int val;
+ operator int &() { return val; }
+ };
+ It begin();
+ It end();
+ };
+
+ constexpr int operator*(const C::It &) { return 0; }
}
using X::A;
@@ -118,7 +130,7 @@ void g() {
for (extern int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'extern'}}
for (static int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'static'}}
for (register int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'register'}} expected-warning {{deprecated}}
- for (constexpr int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'constexpr'}}
+ for (constexpr int a : X::C()) {} // OK per CWG issue #1204.
for (auto u : X::NoBeginADL()) { // expected-error {{invalid range expression of type 'X::NoBeginADL'; no viable 'begin' function available}}
}
diff --git a/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp b/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
index e87153b9efe2..249563e7d9bf 100644
--- a/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
+++ b/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp
@@ -114,7 +114,7 @@ namespace reference_parameters {
}
template<typename T, const T &ref> void bind() {
- T &ref2 = ref; // expected-error{{drops qualifiers}}
+ T &ref2 = ref; // expected-error{{drops 'const' qualifier}}
}
int counter;
diff --git a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
index f09faa90d5f9..eb11e3375e5f 100644
--- a/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
+++ b/test/CXX/temp/temp.decls/temp.class/temp.mem.func/p1inst.cpp
@@ -8,7 +8,7 @@ struct X0 {
template<typename T, typename U>
void X0<T, U>::f(T *t, const U &u) {
- *t = u; // expected-error{{not assignable}}
+ *t = u; // expected-warning{{indirection on operand of type 'void *'}} expected-error{{not assignable}}
}
void test_f(X0<float, int> xfi, X0<void, int> xvi, float *fp, void *vp, int i) {
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp
index b2a6219d04e6..9b3088f20e94 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p4.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
template<class T> struct A { A(); };
template<class T> int &f(T);
@@ -21,3 +22,23 @@ void m() {
const A<int> z2;
int &ir1 = h(z2);
}
+
+
+namespace core_26909 {
+ template<typename T> struct A {};
+ template<typename T, typename U> void f(T&, U); // expected-note {{candidate}}
+ template<typename T, typename U> void f(T&&, A<U>); // expected-note {{candidate}} expected-warning 0-1{{extension}}
+ template<typename T, typename U> void g(const T&, U); // expected-note {{candidate}}
+ template<typename T, typename U> void g(T&, A<U>); // expected-note {{candidate}}
+
+ void h(int a, const char b, A<int> c) {
+ f(a, c); // expected-error{{ambiguous}}
+ g(b, c); // expected-error{{ambiguous}}
+ }
+}
+
+namespace PR22435 {
+ template<typename T, typename U> void foo(void (*)(T), const U &); // expected-note {{candidate}}
+ template<typename T, typename U> bool foo(void (*)(T &), U &); // expected-note {{candidate}}
+ void bar(const int x) { bool b = foo<char>(0, x); } // expected-error {{ambiguous}}
+}
diff --git a/test/CXX/temp/temp.decls/temp.mem/p5.cpp b/test/CXX/temp/temp.decls/temp.mem/p5.cpp
index 8bcd773ee98b..1e061fa33d3a 100644
--- a/test/CXX/temp/temp.decls/temp.mem/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.mem/p5.cpp
@@ -55,8 +55,8 @@ template double Foo::As2();
// Partial ordering with conversion function templates.
struct X0 {
template<typename T> operator T*() {
- T x = 1;
- x = 17; // expected-error{{read-only variable is not assignable}}
+ T x = 1; // expected-note{{variable 'x' declared const here}}
+ x = 17; // expected-error{{cannot assign to variable 'x' with const-qualified type 'const int'}}
}
template<typename T> operator T*() const; // expected-note{{explicit instantiation refers here}}
diff --git a/test/CXX/temp/temp.param/p15-cxx0x.cpp b/test/CXX/temp/temp.param/p15-cxx0x.cpp
index 59618d263683..ade192b3efa9 100644
--- a/test/CXX/temp/temp.param/p15-cxx0x.cpp
+++ b/test/CXX/temp/temp.param/p15-cxx0x.cpp
@@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
-template<typename T> struct X;
+template<typename T> struct X; // expected-note {{'X' is incomplete}}
template<int I> struct Y;
X<X<int>> *x1;
diff --git a/test/CXX/temp/temp.res/temp.local/p3.cpp b/test/CXX/temp/temp.res/temp.local/p3.cpp
index e29ced19bc4f..d5e378660596 100644
--- a/test/CXX/temp/temp.res/temp.local/p3.cpp
+++ b/test/CXX/temp/temp.res/temp.local/p3.cpp
@@ -15,7 +15,7 @@ template <class T> struct Derived: Base<int>, Base<char> {
t->Base<T>::f();
t->Base::f(); // expected-error{{member 'Base' found in multiple base classes of different types}} \
// expected-error{{no member named 'f' in 'X0'}} \
- // expected-error{{'Base' is not a class, namespace, or scoped enumeration}}
+ // expected-error{{'Base' is not a class, namespace, or enumeration}}
}
};