aboutsummaryrefslogtreecommitdiff
path: root/test/CXX
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2011-10-20 21:14:49 +0000
committerDimitry Andric <dim@FreeBSD.org>2011-10-20 21:14:49 +0000
commit36981b17ed939300f6f8fc2355a255f711fcef71 (patch)
treeee2483e98b09cac943dc93a6969d83ca737ff139 /test/CXX
parent180abc3db9ae3b4fc63cd65b15697e6ffcc8a657 (diff)
downloadsrc-36981b17ed939300f6f8fc2355a255f711fcef71.tar.gz
src-36981b17ed939300f6f8fc2355a255f711fcef71.zip
Notes
Diffstat (limited to 'test/CXX')
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp18
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp2
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp2
-rw-r--r--test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp2
-rw-r--r--test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp2
-rw-r--r--test/CXX/basic/basic.types/p10.cpp127
-rw-r--r--test/CXX/class.access/class.friend/p1.cpp13
-rw-r--r--test/CXX/class.access/class.friend/p2-cxx03.cpp2
-rw-r--r--test/CXX/class.access/class.friend/p3-cxx0x.cpp2
-rw-r--r--test/CXX/class.access/class.friend/p6.cpp20
-rw-r--r--test/CXX/class.access/class.protected/p1.cpp2
-rw-r--r--test/CXX/class.access/p6.cpp22
-rw-r--r--test/CXX/class.derived/class.virtual/p3-0x.cpp2
-rw-r--r--test/CXX/class/class.bit/p2.cpp22
-rw-r--r--test/CXX/class/class.friend/p2.cpp2
-rw-r--r--test/CXX/class/class.friend/p6.cpp2
-rw-r--r--test/CXX/class/class.mem/p5-0x.cpp2
-rw-r--r--test/CXX/class/class.mem/p8-0x.cpp2
-rw-r--r--test/CXX/class/class.nest/p1-cxx0x.cpp2
-rw-r--r--test/CXX/class/class.static/class.static.data/p3.cpp26
-rw-r--r--test/CXX/class/p1-0x.cpp2
-rw-r--r--test/CXX/class/p2-0x.cpp2
-rw-r--r--test/CXX/class/p6-0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp2
-rw-r--r--test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp92
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp26
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp125
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp226
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp74
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp28
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp37
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp4
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp17
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp3
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp20
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp15
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp10
-rw-r--r--test/CXX/dcl.dcl/dcl.spec/dcl.typedef/p2-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp9
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp33
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp175
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-0x.cpp40
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp7
-rw-r--r--test/CXX/dcl.decl/dcl.init/p14-0x.cpp4
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p4.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp62
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp2
-rw-r--r--test/CXX/dcl.decl/p4-0x.cpp2
-rw-r--r--test/CXX/except/except.spec/canonical.cpp2
-rw-r--r--test/CXX/except/except.spec/p1.cpp14
-rw-r--r--test/CXX/except/except.spec/p11.cpp2
-rw-r--r--test/CXX/except/except.spec/p14.cpp2
-rw-r--r--test/CXX/except/except.spec/p15.cpp2
-rw-r--r--test/CXX/except/except.spec/p2-places.cpp2
-rw-r--r--test/CXX/except/except.spec/p3.cpp2
-rw-r--r--test/CXX/except/except.spec/p5-pointers.cpp2
-rw-r--r--test/CXX/except/except.spec/p5-virtual.cpp2
-rw-r--r--test/CXX/except/except.spec/p9-dynamic.cpp5
-rw-r--r--test/CXX/except/except.spec/p9-noexcept.cpp5
-rw-r--r--test/CXX/except/except.spec/template.cpp2
-rw-r--r--test/CXX/expr/expr.cast/p4-0x.cpp2
-rw-r--r--test/CXX/expr/expr.const/p2-0x.cpp2
-rw-r--r--test/CXX/expr/expr.mptr.oper/p6-0x.cpp2
-rw-r--r--test/CXX/expr/expr.post/expr.call/p7-0x.cpp15
-rw-r--r--test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp2
-rw-r--r--test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp2
-rw-r--r--test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp2
-rw-r--r--test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp2
-rw-r--r--test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp2
-rw-r--r--test/CXX/expr/expr.prim/p12-0x.cpp2
-rw-r--r--test/CXX/expr/expr.prim/p4-0x.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.new/p20-0x.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp6
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.noexcept/sema.cpp2
-rw-r--r--test/CXX/expr/expr.unary/expr.unary.op/p6.cpp7
-rw-r--r--test/CXX/lex/lex.literal/lex.ccon/p1.cpp7
-rw-r--r--test/CXX/lex/lex.literal/lex.ext/p1.cpp7
-rw-r--r--test/CXX/lex/lex.pptoken/p3-0x.cpp2
-rw-r--r--test/CXX/over/over.built/p23.cpp25
-rw-r--r--test/CXX/over/over.built/p25.cpp2
-rw-r--r--test/CXX/over/over.load/p2-0x.cpp2
-rw-r--r--test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp2
-rw-r--r--test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp2
-rw-r--r--test/CXX/over/over.match/over.match.funcs/p4-0x.cpp2
-rw-r--r--test/CXX/over/over.over/p2-resolve-single-template-id.cpp30
-rw-r--r--test/CXX/special/class.copy/implicit-move-def.cpp116
-rw-r--r--test/CXX/special/class.copy/implicit-move.cpp164
-rw-r--r--test/CXX/special/class.copy/p11.0x.copy.cpp90
-rw-r--r--test/CXX/special/class.copy/p11.0x.move.cpp85
-rw-r--r--test/CXX/special/class.copy/p15-0x.cpp18
-rw-r--r--test/CXX/special/class.copy/p33-0x.cpp2
-rw-r--r--test/CXX/special/class.ctor/p4-0x.cpp2
-rw-r--r--test/CXX/special/class.ctor/p5-0x.cpp6
-rw-r--r--test/CXX/special/class.dtor/p2-0x.cpp2
-rw-r--r--test/CXX/special/class.dtor/p3-0x.cpp2
-rw-r--r--test/CXX/special/class.inhctor/elsewhere.cpp2
-rw-r--r--test/CXX/special/class.inhctor/p3.cpp6
-rw-r--r--test/CXX/special/class.inhctor/p7.cpp2
-rw-r--r--test/CXX/special/class.init/class.base.init/p8-0x.cpp40
-rw-r--r--test/CXX/special/class.init/class.base.init/p9-0x.cpp2
-rw-r--r--test/CXX/special/class.temporary/p1.cpp58
-rw-r--r--test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp2
-rw-r--r--test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp7
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp2
-rw-r--r--test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp2
-rw-r--r--test/CXX/temp/temp.decls/p3.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.alias/p1.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.alias/p2.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.alias/p3.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.friend/p1.cpp24
-rw-r--r--test/CXX/temp/temp.decls/temp.mem/p5.cpp5
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/deduction.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/example-function.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp17
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p1.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p2.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p4.cpp3
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/p5.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp2
-rw-r--r--test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp6
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp12
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp2
-rw-r--r--test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p10-0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p11-0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p15-cxx0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p15.cpp2
-rw-r--r--test/CXX/temp/temp.param/p9-0x.cpp2
-rw-r--r--test/CXX/temp/temp.param/p9.cpp4
-rw-r--r--test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp11
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp2
-rw-r--r--test/CXX/temp/temp.spec/temp.explicit/p9.cpp2
-rw-r--r--test/CXX/temp/temp.type/p1-0x.cpp2
176 files changed, 2059 insertions, 231 deletions
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp b/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
index 3fde0daa96cf..c35af1def208 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
@@ -44,3 +44,21 @@ void resolves_to_different() {
v.set<double>(3.2);
}
}
+
+namespace rdar9915664 {
+ struct A {
+ template<typename T> void a();
+ };
+
+ struct B : A { };
+
+ struct C : A { };
+
+ struct D : B, C {
+ A &getA() { return static_cast<B&>(*this); }
+
+ void test_a() {
+ getA().a<int>();
+ }
+ };
+}
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp b/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp
index 4a0b38737976..cd7e669527bc 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p3.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
// C++0x [basic.lookup.classref]p3:
-// If the unqualified-id is ∼type-name, the type-name is looked up in the
+// If the unqualified-id is ~type-name, the type-name is looked up in the
// context of the entire postfix-expression. If the type T of the object
// expression is of a class type C, the type-name is also looked up in the
// scope of class C. At least one of the lookups shall find a name that
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp
index 355ac4a2ecad..c745c8451bc8 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/p6-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// XFAIL: *
// Our C++0x doesn't currently have specialized destructor name handling,
// since the specification is still in flux.
diff --git a/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp b/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp
index d930f97ce791..cd51c78a5e9c 100644
--- a/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp
+++ b/test/CXX/basic/basic.scope/basic.scope.local/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
void f() {
int b;
diff --git a/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp b/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp
index 751c0df6b867..407a5f744e37 100644
--- a/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp
+++ b/test/CXX/basic/basic.scope/basic.scope.pdecl/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// Classes.
namespace Class {
diff --git a/test/CXX/basic/basic.types/p10.cpp b/test/CXX/basic/basic.types/p10.cpp
new file mode 100644
index 000000000000..3b438d15f28b
--- /dev/null
+++ b/test/CXX/basic/basic.types/p10.cpp
@@ -0,0 +1,127 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct NonLiteral { NonLiteral(); };
+
+// A type is a literal type if it is:
+
+// - a scalar type
+constexpr int f1(double);
+
+// - a reference type
+struct S { S(); };
+constexpr int f2(S &);
+
+// - a class type that has all of the following properties:
+
+// - it has a trivial destructor
+struct UserProvDtor {
+ constexpr UserProvDtor(); // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}}
+ ~UserProvDtor(); // expected-note {{has a user-provided destructor}}
+};
+struct NonTrivDtor {
+ constexpr NonTrivDtor(); // expected-error {{non-literal type 'NonTrivDtor' cannot have constexpr members}}
+ virtual ~NonTrivDtor() = default; // expected-note {{has a non-trivial destructor}}
+};
+struct NonTrivDtorBase {
+ ~NonTrivDtorBase();
+};
+template<typename T>
+struct DerivedFromNonTrivDtor : T { // expected-note {{'DerivedFromNonTrivDtor<NonTrivDtorBase>' is not literal because it has base class 'NonTrivDtorBase' of non-literal type}}
+ constexpr DerivedFromNonTrivDtor();
+};
+constexpr int f(DerivedFromNonTrivDtor<NonTrivDtorBase>); // expected-error {{constexpr function's 1st parameter type 'DerivedFromNonTrivDtor<NonTrivDtorBase>' is not a literal type}}
+struct TrivDtor {
+ constexpr TrivDtor();
+};
+// FIXME: when building DefinitionData we look at 'isUserProvided' before it's set up!
+#if 0
+struct TrivDefaultedDtor {
+ constexpr TrivDefaultedDtor();
+ ~TrivDefaultedDtor() = default;
+};
+#endif
+
+// - it is an aggregate type or has at least one constexpr constructor or
+// constexpr constructor template that is not a copy or move constructor
+struct Agg {
+ int a;
+ char *b;
+};
+constexpr int f3(Agg a) { return a.a; }
+struct CtorTemplate {
+ template<typename T> constexpr CtorTemplate(T);
+};
+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&); // expected-error {{non-literal type 'CopyCtorOnly' cannot have constexpr members}}
+};
+struct MoveCtorOnly { // expected-note {{no constexpr constructors other than copy or move constructors}}
+ constexpr MoveCtorOnly(MoveCtorOnly&&); // expected-error {{non-literal type 'MoveCtorOnly' cannot have constexpr members}}
+};
+template<typename T>
+struct CtorArg { // expected-note {{no constexpr constructors other than copy or move constructors}}
+ constexpr CtorArg(T); // expected-note {{constructor template instantiation is not constexpr because 1st parameter type 'NonLiteral' is not a literal type}}
+};
+constexpr int f(CtorArg<int>);
+constexpr int f(CtorArg<NonLiteral>); // expected-error {{not a literal type}}
+// We have a special-case diagnostic for classes with virtual base classes.
+struct VBase {};
+struct HasVBase : virtual VBase {}; // expected-note 2{{virtual base class declared here}}
+struct Derived : HasVBase {
+ constexpr Derived(); // expected-error {{constexpr constructor not allowed in struct with virtual base class}}
+};
+template<typename T> struct DerivedFromVBase : T { // expected-note {{struct with virtual base class is not a literal type}}
+ constexpr DerivedFromVBase();
+};
+constexpr int f(DerivedFromVBase<HasVBase>); // expected-error {{constexpr function's 1st parameter type 'DerivedFromVBase<HasVBase>' is not a literal type}}
+
+// - it has all non-static data members and base classes of literal types
+struct NonLitMember {
+ S s; // expected-note {{has data member 's' of non-literal type 'S'}}
+};
+constexpr int f(NonLitMember); // expected-error {{1st parameter type 'NonLitMember' is not a literal type}}
+struct NonLitBase :
+ S { // expected-note {{base class 'S' of non-literal type}}
+ constexpr NonLitBase(); // expected-error {{non-literal type 'NonLitBase' cannot have constexpr members}}
+};
+struct LitMemBase : Agg {
+ Agg agg;
+};
+template<typename T>
+struct MemberType {
+ T t; // expected-note {{'MemberType<NonLiteral>' is not literal because it has data member 't' of non-literal type 'NonLiteral'}}
+ constexpr MemberType();
+};
+constexpr int f(MemberType<int>);
+constexpr int f(MemberType<NonLiteral>); // expected-error {{not a literal type}}
+
+// - an array of literal type
+struct ArrGood {
+ Agg agg[24];
+ double d[12];
+ TrivDtor td[3];
+};
+constexpr int f(ArrGood);
+
+struct ArrBad {
+ S s[3]; // expected-note {{data member 's' of non-literal type 'S [3]'}}
+};
+constexpr int f(ArrBad); // expected-error {{1st parameter type 'ArrBad' is not a literal type}}
+
+
+// As a non-conforming tweak to the standard, we do not allow a literal type to
+// have any mutable data members.
+namespace MutableMembers {
+ struct MM {
+ mutable int n; // expected-note {{'MM' is not literal because it has a mutable data member}}
+ };
+ constexpr int f(MM); // expected-error {{not a literal type}}
+
+ // Here's one reason why allowing this would be a disaster...
+ template<int n> struct Id { int k = n; };
+ int f() {
+ // FIXME: correctly check whether the initializer is a constant expression.
+ constexpr MM m = { 0 }; // desired-error {{must be a constant expression}}
+ ++m.n;
+ return Id<m.n>().k; // expected-error {{not an integral constant expression}}
+ }
+}
diff --git a/test/CXX/class.access/class.friend/p1.cpp b/test/CXX/class.access/class.friend/p1.cpp
index 1668155c1819..68ff83fee83c 100644
--- a/test/CXX/class.access/class.friend/p1.cpp
+++ b/test/CXX/class.access/class.friend/p1.cpp
@@ -341,3 +341,16 @@ namespace test12 {
void *var = static_cast<B*>(this)->mem;
}
}
+
+namespace PR9103 {
+ struct base {
+ protected:
+ static void foo(void) {}
+ };
+
+ struct cls: base {
+ friend void bar(void) {
+ base::foo();
+ }
+ };
+}
diff --git a/test/CXX/class.access/class.friend/p2-cxx03.cpp b/test/CXX/class.access/class.friend/p2-cxx03.cpp
index 82cddc2bad50..f8cabfd78a8f 100644
--- a/test/CXX/class.access/class.friend/p2-cxx03.cpp
+++ b/test/CXX/class.access/class.friend/p2-cxx03.cpp
@@ -1,7 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
template<typename T>
class X0 {
- friend T; // expected-warning{{non-class friend type 'T' is a C++0x extension}}
+ friend T; // expected-warning{{non-class friend type 'T' is a C++11 extension}}
};
class X1 { };
diff --git a/test/CXX/class.access/class.friend/p3-cxx0x.cpp b/test/CXX/class.access/class.friend/p3-cxx0x.cpp
index 4f55e5339ab2..00fc0a33bef2 100644
--- a/test/CXX/class.access/class.friend/p3-cxx0x.cpp
+++ b/test/CXX/class.access/class.friend/p3-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
template<typename T>
class X0 {
friend T;
diff --git a/test/CXX/class.access/class.friend/p6.cpp b/test/CXX/class.access/class.friend/p6.cpp
new file mode 100644
index 000000000000..7f7d90990328
--- /dev/null
+++ b/test/CXX/class.access/class.friend/p6.cpp
@@ -0,0 +1,20 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+void f1();
+
+struct X {
+ void f2();
+};
+
+struct Y {
+ friend void ::f1() { } // expected-error{{friend function definition cannot be qualified with '::'}}
+ friend void X::f2() { } // expected-error{{friend function definition cannot be qualified with 'X::'}}
+};
+
+void local() {
+ void f();
+
+ struct Local {
+ friend void f() { } // expected-error{{friend function cannot be defined in a local class}}
+ };
+}
diff --git a/test/CXX/class.access/class.protected/p1.cpp b/test/CXX/class.access/class.protected/p1.cpp
index 8698fb1da8a5..79bb6cd67eab 100644
--- a/test/CXX/class.access/class.protected/p1.cpp
+++ b/test/CXX/class.access/class.protected/p1.cpp
@@ -423,7 +423,7 @@ namespace test12 {
// This friendship is not considered because a public member of A is
// inaccessible in C.
namespace test13 {
- class A { protected: int foo(); }; // expected-note {{declared protected here}}
+ class A { protected: int foo(); }; // expected-note {{object type 'test13::D' must derive from context type 'test13::C'}}
class B : private virtual A {};
class C : private B { friend void test(); };
class D : public virtual A {};
diff --git a/test/CXX/class.access/p6.cpp b/test/CXX/class.access/p6.cpp
index fe3304a22253..932b4f42f2a3 100644
--- a/test/CXX/class.access/p6.cpp
+++ b/test/CXX/class.access/p6.cpp
@@ -168,3 +168,25 @@ namespace test7 {
void foo(int arg[__builtin_offsetof(B, ins)]);
}
}
+
+// rdar://problem/10155256
+namespace test8 {
+ class A {
+ typedef void* (A::*UnspecifiedBoolType)() const;
+ operator UnspecifiedBoolType() const; // expected-note {{implicitly declared private here}}
+ };
+
+ void test(A &a) {
+ if (a) return; // expected-error {{'operator void *(class test8::A::*)(void) const' is a private member of 'test8::A'}}
+ }
+}
+
+namespace test9 {
+ class A {
+ operator char*() const; // expected-note {{implicitly declared private here}}
+ };
+
+ void test(A &a) {
+ delete a; // expected-error {{'operator char *' is a private member of 'test9::A'}}
+ }
+}
diff --git a/test/CXX/class.derived/class.virtual/p3-0x.cpp b/test/CXX/class.derived/class.virtual/p3-0x.cpp
index 4bd9efda1f6c..c4a401bb27c5 100644
--- a/test/CXX/class.derived/class.virtual/p3-0x.cpp
+++ b/test/CXX/class.derived/class.virtual/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
namespace Test1 {
diff --git a/test/CXX/class/class.bit/p2.cpp b/test/CXX/class/class.bit/p2.cpp
new file mode 100644
index 000000000000..7962330d1612
--- /dev/null
+++ b/test/CXX/class/class.bit/p2.cpp
@@ -0,0 +1,22 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct A {
+private:
+ int : 0;
+};
+
+A a = { };
+A a2 = { 1 }; // expected-error{{excess elements in struct initializer}}
+
+struct B {
+ const int : 0;
+};
+
+B b;
+
+void testB() {
+ B b2(b);
+ B b3(static_cast<B&&>(b2));
+ b = b;
+ b = static_cast<B&&>(b);
+}
diff --git a/test/CXX/class/class.friend/p2.cpp b/test/CXX/class/class.friend/p2.cpp
index 87b69c095fbd..fb3cd19b2b18 100644
--- a/test/CXX/class/class.friend/p2.cpp
+++ b/test/CXX/class/class.friend/p2.cpp
@@ -4,7 +4,7 @@ struct B0;
class A {
friend class B {}; // expected-error {{cannot define a type in a friend declaration}}
- friend int; // expected-warning {{non-class friend type 'int' is a C++0x extension}}
+ friend int; // expected-warning {{non-class friend type 'int' is a C++11 extension}}
friend B0; // expected-warning {{specify 'struct' to befriend 'B0'}}
friend class C; // okay
};
diff --git a/test/CXX/class/class.friend/p6.cpp b/test/CXX/class/class.friend/p6.cpp
index bd4630e2aa9d..82a90ff82f20 100644
--- a/test/CXX/class/class.friend/p6.cpp
+++ b/test/CXX/class/class.friend/p6.cpp
@@ -3,7 +3,7 @@
class A {
friend static class B; // expected-error {{'static' is invalid in friend declarations}}
friend extern class C; // expected-error {{'extern' is invalid in friend declarations}}
- friend auto class D; // expected-error {{'auto' is invalid in friend declarations}}
+ friend auto class D; // expected-warning {{incompatible with C++11}} expected-error {{'auto' is invalid in friend declarations}}
friend register class E; // expected-error {{'register' is invalid in friend declarations}}
friend mutable class F; // expected-error {{'mutable' is invalid in friend declarations}}
friend typedef class G; // expected-error {{'typedef' is invalid in friend declarations}}
diff --git a/test/CXX/class/class.mem/p5-0x.cpp b/test/CXX/class/class.mem/p5-0x.cpp
index 78560e2d5daa..6061c4c20a67 100644
--- a/test/CXX/class/class.mem/p5-0x.cpp
+++ b/test/CXX/class/class.mem/p5-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
int f();
diff --git a/test/CXX/class/class.mem/p8-0x.cpp b/test/CXX/class/class.mem/p8-0x.cpp
index 836ebad48ee1..d2c3dc36075b 100644
--- a/test/CXX/class/class.mem/p8-0x.cpp
+++ b/test/CXX/class/class.mem/p8-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
struct Base1 {
virtual void g();
diff --git a/test/CXX/class/class.nest/p1-cxx0x.cpp b/test/CXX/class/class.nest/p1-cxx0x.cpp
index f8b06ac5f7e3..0f12579ee4f8 100644
--- a/test/CXX/class/class.nest/p1-cxx0x.cpp
+++ b/test/CXX/class/class.nest/p1-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
class Outer {
int x;
diff --git a/test/CXX/class/class.static/class.static.data/p3.cpp b/test/CXX/class/class.static/class.static.data/p3.cpp
new file mode 100644
index 000000000000..007e416e6a49
--- /dev/null
+++ b/test/CXX/class/class.static/class.static.data/p3.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct NonLit {
+ NonLit();
+};
+
+struct S {
+ static constexpr int a = 0;
+ static constexpr int b; // expected-error {{declaration of constexpr variable 'b' requires an initializer}}
+
+ static constexpr int c = 0;
+ static const int d;
+ static const int d2 = 0;
+
+ static constexpr double e = 0.0; // ok
+ static const double f = 0.0; // expected-warning {{extension}} expected-note {{use 'constexpr' specifier}}
+ static char *const g = 0; // expected-error {{requires 'constexpr' specifier}}
+ static const NonLit h = NonLit(); // expected-error {{must be initialized out of line}}
+};
+
+constexpr int S::a;
+constexpr int S::b = 0;
+
+const int S::c;
+constexpr int S::d = 0;
+constexpr int S::d2;
diff --git a/test/CXX/class/p1-0x.cpp b/test/CXX/class/p1-0x.cpp
index e677dec4caf1..be5fdffb43f4 100644
--- a/test/CXX/class/p1-0x.cpp
+++ b/test/CXX/class/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
namespace Test1 {
class A final { };
diff --git a/test/CXX/class/p2-0x.cpp b/test/CXX/class/p2-0x.cpp
index 630aa7e70f90..dbb01e5ad528 100644
--- a/test/CXX/class/p2-0x.cpp
+++ b/test/CXX/class/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
namespace Test1 {
class A final { }; // expected-note {{'A' declared here}}
diff --git a/test/CXX/class/p6-0x.cpp b/test/CXX/class/p6-0x.cpp
index fc83e065fa6f..3384af09c788 100644
--- a/test/CXX/class/p6-0x.cpp
+++ b/test/CXX/class/p6-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
class Trivial { int n; void f(); };
class NonTrivial1 { NonTrivial1(const NonTrivial1 &); };
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp
index e3d3d683ceb7..98d12f99a598 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p7.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
namespace NIL {} // expected-note {{previous definition}}
inline namespace NIL {} // expected-error {{cannot be reopened as inline}}
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp
index 7c4a21c35a7d..3bc485601ca5 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.def/p8.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// Fun things you can do with inline namespaces:
diff --git a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
index 3f3bf4a2eccb..f61437ead6e4 100644
--- a/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/basic.namespace/namespace.udecl/p3-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// C++0x N2914.
struct B {
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 cd71d55fc5ce..ed98c1e9c56d 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p1.cpp
@@ -1,5 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s
-// XFAIL: *
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct notlit {
notlit() {}
@@ -12,35 +11,82 @@ struct notlit2 {
constexpr int i1 = 0;
constexpr int f1() { return 0; }
struct s1 {
- constexpr static int mi = 0;
+ constexpr static int mi1 = 0;
+ const static int mi2;
};
+constexpr int s1::mi2 = 0;
// invalid declarations
// not a definition of an object
-constexpr extern int i2; // x
+constexpr extern int i2; // expected-error {{constexpr variable declaration must be a definition}}
// not a literal type
-constexpr notlit nl1; // x
+constexpr notlit nl1; // expected-error {{declaration of constexpr variable 'nl1' requires an initializer}}
// function parameters
-void f2(constexpr int i) {} // x
+void f2(constexpr int i) {} // expected-error {{function parameter cannot be constexpr}}
// non-static member
struct s2 {
- constexpr int mi; // x
+ constexpr int mi1; // expected-error {{non-static data member cannot be constexpr}}
+ static constexpr int mi2; // expected-error {{requires an initializer}}
};
+// typedef
+typedef constexpr int CI; // expected-error {{typedef cannot be constexpr}}
+// tag
+constexpr class C1 {}; // expected-error {{class cannot be marked constexpr}}
+constexpr struct S1 {}; // expected-error {{struct cannot be marked constexpr}}
+constexpr union U1 {}; // expected-error {{union cannot be marked constexpr}}
+constexpr enum E1 {}; // expected-error {{enum cannot be marked constexpr}}
+class C2 {} constexpr; // expected-error {{class cannot be marked constexpr}}
+struct S2 {} constexpr; // expected-error {{struct cannot be marked constexpr}}
+union U2 {} constexpr; // expected-error {{union cannot be marked constexpr}}
+enum E2 {} constexpr; // expected-error {{enum cannot be marked constexpr}}
+constexpr class C3 {} c3 = C3();
+constexpr struct S3 {} s3 = S3();
+constexpr union U3 {} u3 = {};
+constexpr enum E3 { V3 } e3 = V3;
+class C4 {} constexpr c4 = C4();
+struct S4 {} constexpr s4 = S4();
+union U4 {} constexpr u4 = {};
+enum E4 { V4 } constexpr e4 = V4;
+constexpr int; // expected-error {{constexpr can only be used in variable and function declarations}}
// redeclaration mismatch
-constexpr int f3(); // n
-int f3(); // x
-int f4(); // n
-constexpr int f4(); // x
+constexpr int f3(); // expected-note {{previous declaration is here}}
+int f3(); // expected-error {{non-constexpr declaration of 'f3' follows constexpr declaration}}
+int f4(); // expected-note {{previous declaration is here}}
+constexpr int f4(); // expected-error {{constexpr declaration of 'f4' follows non-constexpr declaration}}
+template<typename T> constexpr T f5(T);
+template<typename T> constexpr T f5(T); // expected-note {{previous}}
+template<typename T> T f5(T); // expected-error {{non-constexpr declaration of 'f5' follows constexpr declaration}}
+template<typename T> T f6(T); // expected-note {{here}}
+template<typename T> constexpr T f6(T); // expected-error {{constexpr declaration of 'f6' follows non-constexpr declaration}}
+// destructor
+struct ConstexprDtor {
+ constexpr ~ConstexprDtor() = default; // expected-error {{destructor cannot be marked constexpr}}
+};
// template stuff
-template <typename T>
-constexpr T ft(T t) { return t; }
+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();
+ template<typename T> T g() const;
+};
-// specialization can differ in constepxr
-template <>
-notlit ft(notlit nl) { return nl; }
+// explicit specialization can differ in constepxr
+// FIXME: When checking the explicit specialization, we implicitly instantiate
+// the primary template then claim a constexpr mismatch.
+template <> notlit ft(notlit nl) { return nl; }
+template <> char ft(char c) { return c; } // desired-note {{previous}} unexpected-error {{follows constexpr declaration}} unexpected-note {{here}}
+template <> constexpr char ft(char nl); // desired-error {{constexpr declaration of 'ft<char>' follows non-constexpr declaration}}
+template <> constexpr int gt(int nl) { return nl; } // unexpected-error {{follows non-constexpr declaration}} unexpected-note {{here}}
+template <> notlit S::f() const { return notlit(); }
+template <> constexpr int S::g() { return 0; } // desired-note {{previous}} unexpected-error {{follows non-constexpr declaration}} unexpected-note {{here}}
+template <> int S::g() const; // desired-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}}
+template <> double S::g() const { return 0; } // ok
-constexpr int i3 = ft(1);
+// FIXME: The initializer is a constant expression.
+constexpr int i3 = ft(1); // unexpected-error {{must be initialized by a constant expression}}
void test() {
// ignore constexpr when instantiating with non-literal
@@ -52,7 +98,7 @@ void test() {
constexpr int square(int x);
constexpr int bufsz = 1024;
-constexpr struct pixel { // x
+constexpr struct pixel { // expected-error {{struct cannot be marked constexpr}}
int x;
int y;
constexpr pixel(int);
@@ -62,17 +108,17 @@ constexpr pixel::pixel(int a)
: x(square(a)), y(square(a))
{ }
-constexpr pixel small(2); // x (no definition of square(int) yet, so can't
- // constexpr-eval pixel(int))
+constexpr pixel small(2); // expected-error {{must be initialized by a constant expression}}
constexpr int square(int x) {
return x * x;
}
-constexpr pixel large(4); // now valid
+// FIXME: The initializer is a constant expression.
+constexpr pixel large(4); // unexpected-error {{must be initialized by a constant expression}}
-int next(constexpr int x) { // x
+int next(constexpr int x) { // expected-error {{function parameter cannot be constexpr}}
return x + 1;
}
-extern constexpr int memsz; // x
+extern constexpr int memsz; // expected-error {{constexpr variable declaration must be a definition}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp
new file mode 100644
index 000000000000..001a086a008b
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p2.cpp
@@ -0,0 +1,26 @@
+// RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - | FileCheck %s
+
+// constexpr functions and constexpr constructors are implicitly inline.
+struct S {
+ constexpr S(int n);
+ constexpr int g();
+ int n;
+};
+
+constexpr S::S(int n) : n(n) {}
+
+constexpr S f(S s) {
+ return s.n * 2;
+}
+
+constexpr int S::g() {
+ return f(*this).n;
+}
+
+// CHECK: define linkonce_odr {{.*}} @_Z1f1S(
+// CHECK: define linkonce_odr {{.*}} @_ZN1SC1Ei(
+// CHECK: define linkonce_odr {{.*}} @_ZNK1S1gEv(
+
+int g() {
+ return f(42).g();
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
new file mode 100644
index 000000000000..03406dbf918a
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p3.cpp
@@ -0,0 +1,125 @@
+// RUN: %clang_cc1 -verify -std=c++11 %s
+
+namespace N {
+ typedef char C;
+}
+
+namespace M {
+ typedef double D;
+}
+
+struct NonLiteral { // expected-note 4{{no constexpr constructors}}
+ NonLiteral() {}
+ NonLiteral(int) {}
+};
+struct Literal {
+ constexpr Literal() {}
+ operator int() const { return 0; }
+};
+
+struct S {
+ virtual int ImplicitlyVirtual() const = 0; // expected-note {{overridden virtual function}}
+};
+struct SS : S {
+ int ImplicitlyVirtual() const;
+};
+
+// Note, the wording applies constraints to the definition of constexpr
+// functions, but we intentionally apply all that we can to the declaration
+// instead. See DR1360.
+
+// The definition of a constexpr function shall satisfy the following
+// constraints:
+struct T : SS { // expected-note {{base class 'SS' of non-literal type}}
+ constexpr T(); // expected-error {{non-literal type 'T' cannot have constexpr members}}
+
+ // - it shall not be virtual;
+ virtual constexpr int ExplicitlyVirtual(); // expected-error {{virtual function cannot be constexpr}}
+
+ constexpr int ImplicitlyVirtual(); // expected-error {{virtual function cannot be constexpr}}
+
+ // - its return type shall be a literal type;
+ constexpr NonLiteral NonLiteralReturn(); // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}}
+ constexpr ~T(); // expected-error {{destructor cannot be marked constexpr}}
+ typedef NonLiteral F();
+ constexpr F NonLiteralReturn2; // expected-error {{constexpr function's return type 'NonLiteral' is not a literal type}}
+
+ // - each of its parameter types shall be a literal type;
+ constexpr int NonLiteralParam(NonLiteral); // expected-error {{constexpr function's 1st parameter type 'NonLiteral' is not a literal type}}
+ typedef int G(NonLiteral);
+ constexpr G NonLiteralParam2; // expected-error {{constexpr function's 1st parameter type 'NonLiteral' is not a literal type}}
+
+ // - its function-body shall be = delete, = default,
+ constexpr int Deleted() = delete;
+ // It's not possible for the function-body to legally be "= default" here.
+ // Other than constructors, only the copy- and move-assignment operators and
+ // destructor can be defaulted. Destructors can't be constexpr since they
+ // don't have a literal return type. Defaulted assignment operators can't be
+ // constexpr since they can't be const.
+ constexpr T &operator=(const T&) = default; // expected-error {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}
+};
+struct U {
+ constexpr U SelfReturn();
+ constexpr int SelfParam(U);
+};
+
+// or a compound-statememt that contains only
+constexpr int AllowedStmts() {
+ // - null statements
+ ;
+
+ // - static_assert-declarations
+ static_assert(true, "the impossible happened!");
+
+ // - typedef declarations and alias-declarations that do not define classes
+ // or enumerations
+ typedef int I;
+ typedef struct S T;
+ using J = int;
+ using K = int[sizeof(I) + sizeof(J)];
+ // Note, the standard requires we reject this.
+ struct U;
+
+ // - using-declarations
+ using N::C;
+
+ // - using-directives
+ using namespace N;
+
+ // - and exactly one return statement
+ return sizeof(K) + sizeof(C) + sizeof(K);
+}
+constexpr int ForStmt() {
+ for (int n = 0; n < 10; ++n) // expected-error {{statement not allowed in constexpr function}}
+ return 0;
+}
+constexpr int VarDecl() {
+ constexpr int a = 0; // expected-error {{variables cannot be declared in a constexpr function}}
+ return 0;
+}
+constexpr int FuncDecl() {
+ constexpr int ForwardDecl(int); // expected-error {{statement not allowed in constexpr function}}
+ return ForwardDecl(42);
+}
+constexpr int ClassDecl1() {
+ typedef struct { } S1; // expected-error {{types cannot be defined in a constexpr function}}
+ return 0;
+}
+constexpr int ClassDecl2() {
+ using S2 = struct { }; // expected-error {{types cannot be defined in a constexpr function}}
+ return 0;
+}
+constexpr int ClassDecl3() {
+ struct S3 { }; // expected-error {{types cannot be defined in a constexpr function}}
+ return 0;
+}
+constexpr int NoReturn() {} // expected-error {{no return statement in constexpr function}}
+constexpr int MultiReturn() {
+ return 0; // expected-note {{return statement}}
+ return 0; // expected-error {{multiple return statements in constexpr function}}
+}
+
+// - every constructor call and implicit conversion used in initializing the
+// return value shall be one of those allowed in a constant expression.
+//
+// We implement the proposed resolution of DR1364 and ignore this bullet.
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp
new file mode 100644
index 000000000000..9218bcf45bb4
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p4.cpp
@@ -0,0 +1,226 @@
+// RUN: %clang_cc1 -verify -std=c++11 -fcxx-exceptions %s
+
+namespace N {
+ typedef char C;
+}
+
+namespace M {
+ typedef double D;
+}
+
+struct NonLiteral { // expected-note 2{{no constexpr constructors}}
+ NonLiteral() {}
+ NonLiteral(int) {}
+};
+struct Literal {
+ constexpr Literal() {}
+ operator int() const { return 0; }
+};
+
+// Note, the wording applies constraints to the definition of constexpr
+// constructors, but we intentionally apply all that we can to the declaration
+// instead. See DR1360.
+
+// In the definition of a constexpr constructor, each of the parameter types
+// shall be a literal type.
+struct S {
+ constexpr S(int, N::C);
+ constexpr S(int, NonLiteral, N::C); // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}}
+ constexpr S(int, NonLiteral = 42); // expected-error {{constexpr constructor's 2nd parameter type 'NonLiteral' is not a literal type}}
+
+ // In addition, either its function-body shall be = delete or = default
+ constexpr S() = default;
+ constexpr S(Literal) = delete;
+};
+
+// or it shall satisfy the following constraints:
+
+// - the class shall not have any virtual base classes;
+struct T : virtual S { // expected-note {{here}}
+ constexpr T(); // expected-error {{constexpr constructor not allowed in struct with virtual base classes}}
+};
+namespace IndirectVBase {
+ struct A {};
+ struct B : virtual A {}; // expected-note {{here}}
+ class C : public B {
+ public:
+ constexpr C(); // expected-error {{constexpr constructor not allowed in class with virtual base classes}}
+ };
+}
+
+// - its function-body shall not be a function-try-block;
+struct U {
+ constexpr U()
+ try // expected-error {{function try block not allowed in constexpr constructor}}
+ : u() {
+ } catch (...) {
+ throw;
+ }
+ int u;
+};
+
+// - the compound-statememt of its function-body shall contain only
+struct V {
+ constexpr V() {
+ // - null statements,
+ ;
+
+ // - static_assert-declarations,
+ static_assert(true, "the impossible happened!");
+
+ // - typedef declarations and alias-declarations that do not define classes
+ // or enumerations,
+ typedef int I;
+ typedef struct S T;
+ using J = int;
+ using K = int[sizeof(I) + sizeof(J)];
+ // Note, the standard requires we reject this.
+ struct U;
+
+ // - using-declarations,
+ using N::C;
+
+ // - and using-directives;
+ using namespace N;
+ }
+
+ constexpr V(int(&)[1]) {
+ for (int n = 0; n < 10; ++n) // expected-error {{statement not allowed in constexpr constructor}}
+ /**/;
+ }
+ constexpr V(int(&)[2]) {
+ constexpr int a = 0; // expected-error {{variables cannot be declared in a constexpr constructor}}
+ }
+ constexpr V(int(&)[3]) {
+ constexpr int ForwardDecl(int); // expected-error {{statement not allowed in constexpr constructor}}
+ }
+ constexpr V(int(&)[4]) {
+ typedef struct { } S1; // expected-error {{types cannot be defined in a constexpr constructor}}
+ }
+ constexpr V(int(&)[5]) {
+ using S2 = struct { }; // expected-error {{types cannot be defined in a constexpr constructor}}
+ }
+ constexpr V(int(&)[6]) {
+ struct S3 { }; // expected-error {{types cannot be defined in a constexpr constructor}}
+ }
+ constexpr V(int(&)[7]) {
+ return; // expected-error {{statement not allowed in constexpr constructor}}
+ }
+};
+
+// - every non-static data member and base class sub-object shall be initialized
+struct W {
+ int n; // expected-note {{member not initialized by constructor}}
+ constexpr W() {} // expected-error {{constexpr constructor must initialize all members}}
+};
+struct AnonMembers {
+ int a; // expected-note {{member not initialized by constructor}}
+ union { // expected-note 2{{member not initialized by constructor}}
+ char b;
+ struct {
+ double c;
+ long d; // expected-note {{member not initialized by constructor}}
+ };
+ union {
+ char e;
+ void *f;
+ };
+ };
+ struct { // expected-note {{member not initialized by constructor}}
+ long long g;
+ struct {
+ int h; // expected-note {{member not initialized by constructor}}
+ double i; // expected-note {{member not initialized by constructor}}
+ };
+ union { // expected-note 2{{member not initialized by constructor}}
+ char *j;
+ AnonMembers *k;
+ };
+ };
+
+ constexpr AnonMembers(int(&)[1]) : a(), b(), g(), h(), i(), j() {} // ok
+ // missing d, i, j/k union
+ constexpr AnonMembers(int(&)[2]) : a(), c(), g(), h() {} // expected-error {{constexpr constructor must initialize all members}}
+ constexpr AnonMembers(int(&)[3]) : a(), e(), g(), h(), i(), k() {} // ok
+ // missing h, j/k union
+ constexpr AnonMembers(int(&)[4]) : a(), c(), d(), g(), i() {} // expected-error {{constexpr constructor must initialize all members}}
+ // missing b/c/d/e/f union
+ constexpr AnonMembers(int(&)[5]) : a(), g(), h(), i(), k() {} // expected-error {{constexpr constructor must initialize all members}}
+ // missing a, b/c/d/e/f union, g/h/i/j/k struct
+ constexpr AnonMembers(int(&)[6]) {} // expected-error {{constexpr constructor must initialize all members}}
+};
+
+template<typename T> using Int = int;
+template<typename T>
+struct TemplateInit {
+ T a;
+ int b; // desired-note {{not initialized}}
+ Int<T> c; // desired-note {{not initialized}}
+ struct {
+ T d;
+ int e; // desired-note {{not initialized}}
+ Int<T> f; // desired-note {{not initialized}}
+ };
+ struct {
+ Literal l;
+ Literal m;
+ Literal n[3];
+ };
+ union { // desired-note {{not initialized}}
+ T g;
+ T h;
+ };
+ // FIXME: This is ill-formed (no diagnostic required). We should diagnose it.
+ constexpr TemplateInit() {} // desired-error {{must initialize all members}}
+};
+template<typename T> struct TemplateInit2 {
+ Literal l;
+ constexpr TemplateInit2() {} // ok
+};
+
+template<typename T> struct weak_ptr {
+ constexpr weak_ptr() : p(0) {}
+ T *p;
+};
+template<typename T> struct enable_shared_from_this {
+ weak_ptr<T> weak_this;
+ constexpr enable_shared_from_this() {} // ok
+};
+constexpr int f(enable_shared_from_this<int>);
+
+// - every constructor involved in initializing non-static data members and base
+// class sub-objects shall be a constexpr constructor.
+//
+// FIXME: Implement this as part of the 'must be able to produce a constant
+// expression' rules.
+
+// - every assignment-expression that is an initializer-caluse appearing
+// directly or indirectly within a brace-or-equal-initializer for a non-static
+// data member that is not named by a mem-initializer-id shall be a constant
+// expression; and
+//
+// Note, we deliberately do not implement this bullet, so that we can allow the
+// following example. (See N3308).
+struct X {
+ int a = 0;
+ int b = 2 * a + 1; // ok, not a constant expression.
+
+ constexpr X() {}
+ constexpr X(int c) : a(c) {} // ok, b initialized by 2 * c + 1
+};
+
+// - every implicit conversion used in converting a constructor argument to the
+// corresponding parameter type and converting a full-expression to the
+// corresponding member type shall be one of those allowed in a constant
+// expression.
+//
+// We implement the proposed resolution of DR1364 and ignore this bullet.
+
+
+namespace StdExample {
+ struct Length {
+ explicit constexpr Length(int i = 0) : val(i) { }
+ private:
+ int val;
+ };
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp
new file mode 100644
index 000000000000..e383bc09226c
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p6.cpp
@@ -0,0 +1,74 @@
+// RUN: %clang_cc1 -verify -std=c++11 %s
+
+namespace N {
+ typedef char C;
+}
+
+namespace M {
+ typedef double D;
+}
+
+struct NonLiteral {
+ NonLiteral() {}
+ NonLiteral(int) {}
+ operator int() const { return 0; }
+};
+struct Literal {
+ constexpr Literal() {}
+ operator int() const { return 0; }
+};
+
+struct S {
+ virtual int ImplicitlyVirtual();
+};
+struct T {};
+
+template<typename T> struct ImplicitVirtualFromDependentBase : T {
+ constexpr int ImplicitlyVirtual() { return 0; }
+};
+
+// FIXME: Can't test this until we have function invocation substitution
+#if 0
+constexpr int a = ImplicitVirtualFromDependentBase<S>().ImplicitlyVirtual(); // desired-error {{not a constant expression}}
+constexpr int b = ImplicitVirtualFromDependentBase<T>().ImplicitlyVirtual(); // ok
+#endif
+
+template<typename R> struct ConstexprMember {
+ constexpr R F() { return 0; }
+};
+// FIXME: Can't test this until we have function invocation substitution
+#if 0
+constexpr int c = ConstexprMember<int>().F(); // ok
+constexpr int d = ConstexprMember<NonLiteral>().F(); // desired-error {{not a constant expression}}
+#endif
+
+template<typename ...P> struct ConstexprCtor { // expected-note 2{{no constexpr constructors}}
+ constexpr ConstexprCtor(P...); // expected-note {{constructor template instantiation is not constexpr because 1st parameter type 'NonLiteral' is not a literal type}} \
+ expected-note {{constructor template instantiation is not constexpr because 2nd parameter type 'NonLiteral' is not a literal type}}
+};
+constexpr ConstexprCtor<> f1(); // ok
+constexpr ConstexprCtor<int> f2(); // ok
+constexpr ConstexprCtor<NonLiteral> f3(); // expected-error {{not a literal type}}
+constexpr ConstexprCtor<int, NonLiteral> f4(); // expected-error {{not a literal type}}
+
+struct VirtBase : virtual S {}; // expected-note {{here}}
+
+namespace TemplateVBase {
+ template<typename T> struct T1 : virtual Literal { // expected-note {{here}}
+ constexpr T1(); // expected-error {{constexpr constructor not allowed in struct with virtual base class}}
+ };
+
+ template<typename T> struct T2 : virtual T { // expected-note {{struct with virtual base class is not a literal type}} expected-note {{here}}
+ // FIXME: This is ill-formed (no diagnostic required).
+ // We should diagnose it now rather than waiting until instantiation.
+ constexpr T2(); // desired-error {{constexpr constructor not allowed in class with virtual base classes}}
+ };
+ constexpr T2<Literal> g2(); // expected-error {{not a literal type}}
+
+ template<typename T> class T3 : public T { // expected-note {{class with virtual base class is not a literal type}}
+ public:
+ constexpr T3() {}
+ };
+ constexpr T3<Literal> g3(); // ok
+ constexpr T3<VirtBase> g4(); // expected-error {{not a literal type}}
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
new file mode 100644
index 000000000000..f7da24dfc20a
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p8.cpp
@@ -0,0 +1,28 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+struct S {
+ constexpr void f();
+ constexpr void g() const;
+};
+
+void f(const S &s) {
+ s.f();
+ s.g();
+}
+
+namespace std_example {
+
+ class debug_flag { // expected-note {{not an aggregate and has no constexpr constructors}}
+ public:
+ explicit debug_flag(bool);
+ constexpr bool is_on(); // expected-error {{non-literal type 'std_example::debug_flag' cannot have constexpr members}}
+ private:
+ bool flag;
+ };
+
+ constexpr int bar(int x, int y) // expected-note {{here}}
+ { return x + y + x*y; }
+ int bar(int x, int y) // expected-error {{non-constexpr declaration of 'bar' follows constexpr declaration}}
+ { return x * 2 + 3 * y; }
+
+}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp
new file mode 100644
index 000000000000..53d232d8a90a
--- /dev/null
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p9.cpp
@@ -0,0 +1,37 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+// A constexpr specifier used in an object declaration declares the object as
+// const.
+constexpr int a = 0;
+extern const int a;
+
+int i;
+constexpr int *b = &i;
+extern int *const b;
+
+constexpr int &c = i;
+extern int &c;
+
+constexpr int (*d)(int) = 0;
+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 {{declaration of constexpr variable 'ni1' requires an initializer}}
+constexpr struct C { C(); } ni2; // expected-error {{declaration of constexpr variable 'ni2' requires an initializer}}
+constexpr double &ni3; // expected-error {{declaration of constexpr variable 'ni3' requires an initializer}}
+
+constexpr int nc1 = i; // expected-error {{constexpr variable 'nc1' must be initialized by a constant expression}}
+constexpr C nc2 = C(); // expected-error {{constexpr variable 'nc2' must be initialized by a constant expression}}
+int &f();
+constexpr int &nc3 = f(); // expected-error {{constexpr variable 'nc3' must be initialized by a constant expression}}
+constexpr int nc4(i); // expected-error {{constexpr variable 'nc4' must be initialized by a constant expression}}
+constexpr C nc5((C())); // expected-error {{constexpr variable 'nc5' must be initialized by a constant expression}}
+int &f();
+constexpr int &nc6(f()); // expected-error {{constexpr variable 'nc6' must be initialized by a constant expression}}
+
+struct pixel {
+ int x, y;
+};
+constexpr pixel ur = { 1294, 1024 }; // ok
+constexpr pixel origin; // expected-error {{requires an initializer}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
index fcc1334b1506..ee870d960161 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.fct.spec/p6.cpp
@@ -4,7 +4,7 @@ class A {
public:
explicit A();
- explicit operator int(); // expected-warning {{explicit conversion functions are a C++0x extension}}
+ explicit operator int(); // expected-warning {{explicit conversion functions are a C++11 extension}}
explicit void f0(); // expected-error {{'explicit' can only be applied to a constructor or conversion function}}
@@ -12,5 +12,5 @@ public:
};
explicit A::A() { } // expected-error {{'explicit' can only be specified inside the class definition}}
-explicit A::operator bool() { return false; } // expected-warning {{explicit conversion functions are a C++0x extension}}\
+explicit A::operator bool() { return false; } // expected-warning {{explicit conversion functions are a C++11 extension}}\
// expected-error {{'explicit' can only be specified inside the class definition}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
index 1b1f11a660b5..7b5577520d42 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11
struct S {
virtual ~S();
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
index b675fb8013e3..682ee9f7e4ec 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p3.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions
void f() {
auto a = a; // expected-error{{variable 'a' declared with 'auto' type cannot appear in its own initializer}}
auto *b = b; // expected-error{{variable 'b' declared with 'auto' type cannot appear in its own initializer}}
@@ -39,10 +40,12 @@ void p3example() {
auto x = 5;
const auto *v = &x, u = 6;
static auto y = 0.0;
- auto int r; // expected-warning {{'auto' storage class specifier is redundant and will be removed in future releases}}
-
- same<decltype(x), int> xHasTypeInt;
- same<decltype(v), const int*> vHasTypeConstIntPtr;
- same<decltype(u), const int> uHasTypeConstInt;
- same<decltype(y), double> yHasTypeDouble;
+ // In C++98: 'auto' storage class specifier is redundant and incompatible with C++0x
+ // In C++0x: 'auto' storage class specifier is not permitted in C++0x, and will not be supported in future releases
+ auto int r; // expected-warning {{'auto' storage class specifier}}
+
+ same<__typeof(x), int> xHasTypeInt;
+ same<__typeof(v), const int*> vHasTypeConstIntPtr;
+ same<__typeof(u), const int> uHasTypeConstInt;
+ same<__typeof(y), double> yHasTypeDouble;
}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
index 8a68e4bcd795..095c031a1a0e 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p4.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions
template<typename T>
struct only {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
index 54da854dab55..a52ef41504ac 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify %s -std=c++11
struct S {
virtual ~S();
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
index 8b4b70398471..7ed4daec5dec 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p6.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions
template<typename T>
struct only {
@@ -82,4 +83,21 @@ struct S {
}
};
+namespace PR10939 {
+ struct X {
+ int method(int);
+ int method(float);
+ };
+
+ template<typename T> T g(T);
+
+ void f(X *x) {
+ auto value = x->method; // expected-error{{variable 'value' with type 'auto' has incompatible initializer of type '<bound member function type>'}}
+ if (value) { }
+
+ auto funcptr = &g<int>;
+ int (*funcptr2)(int) = funcptr;
+ }
+}
+
// TODO: if the initializer is a braced-init-list, deduce auto as std::initializer_list<T>.
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
index de87a93a2bc1..4f230cfb8d40 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.spec.auto/p7.cpp
@@ -1,4 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++98 -Wno-c++0x-extensions
void f() {
auto a = 0, b = 0, c = 0;
auto d = 0, e = 0.0; // expected-error {{'int' in declaration of 'd' and deduced as 'double' in declaration of 'e'}}
@@ -18,6 +19,14 @@ void f() {
}
void g() {
- auto a = 0, (*b)() -> void, c = 0;
- auto d = 0, (*e)() -> void, f = 0.0; // expected-error {{'auto' deduced as 'int' in declaration of 'd' and deduced as 'double' in declaration of 'f'}}
+ auto a = 0,
+#if __has_feature(cxx_trailing_return)
+ (*b)() -> void,
+#endif
+ c = 0;
+ auto d = 0, // expected-error {{'auto' deduced as 'int' in declaration of 'd' and deduced as 'double' in declaration of 'f'}}
+#if __has_feature(cxx_trailing_return)
+ (*e)() -> void,
+#endif
+ f = 0.0;
}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp
index 81204d89a697..027104151ac6 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.elab/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct A { typedef int type; };
template<typename T> using X = A; // expected-note {{declared here}}
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
index 19159e159a0c..bc60b5e55a33 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/dcl.type.simple/p4-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
template<typename T, typename U>
struct is_same {
diff --git a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
index b93e8e35b139..e32774a2ee0f 100644
--- a/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
+++ b/test/CXX/dcl.dcl/dcl.spec/dcl.type/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
using X = struct { // ok
};
@@ -7,8 +7,9 @@ template<typename T> using Y = struct { // expected-error {{can not be defined i
class K {
virtual ~K();
- // FIXME: the diagnostic here is really bad
- operator struct S {} (); // expected-error 2{{}} expected-note {{}}
+ // FIXME: Diagnostic could use some work
+ operator struct S {} (); // expected-error{{ 'operator S' cannot be the name of a variable or data member}} \
+ // expected-error{{expected ';' at end of declaration list}}
};
void f() {
@@ -33,8 +34,7 @@ void f() {
void g() throw (struct Ex {}) { // expected-error {{'Ex' can not be defined in a type specifier}}
}
-// FIXME: this currently gives a strange error because alignas is not recognised as a keyword yet.
-int alignas(struct Aa {}) x; // expected-error {{'Aa' can not be defined in a parameter type}} expected-error {{expected function body}}
+int alignas(struct Aa {}) x; // expected-error {{'Aa' can not be defined in a type specifier}}
int a = sizeof(struct So {}); // expected-error {{'So' can not be defined in a type specifier}}
int b = alignof(struct Ao {}); // expected-error {{'Ao' can not be defined in a type specifier}}
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 a51cfbfffcce..0ff40bccef9f 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
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -verify -std=c++0x %s
+// RUN: %clang_cc1 -verify -std=c++11 %s
namespace RedeclAliasTypedef {
typedef int T;
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
index 9b92340fa457..b8c1e18a2e13 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// An aggregate is an array or a class...
struct Aggr {
@@ -18,11 +18,10 @@ struct NonAggr1a {
NonAggr1a(int, int);
int k;
};
-// In C++03, this is {{non-aggregate type 'NonAggr1a'}}.
// In C++0x, 'user-provided' is only defined for special member functions, so
-// this type is considered to be an aggregate. This is probably a langauge
-// defect.
-NonAggr1a na1a = { 42 };
+// this type is considered to be an aggregate. This is considered to be
+// a language defect.
+NonAggr1a na1a = { 42 }; // expected-error {{non-aggregate type 'NonAggr1a'}}
struct NonAggr1b {
NonAggr1b(const NonAggr1b &);
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
index c38bd292efdb..104157115335 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.aggr/p4.cpp
@@ -15,4 +15,4 @@ void tf() {
}
// Allowed by GNU extension
-int a4[] = {}; // expected-warning {{zero size arrays}}
+int a4[] = {}; // expected-error {{zero size arrays}}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
new file mode 100644
index 000000000000..dc49deabdea4
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x-fixits.cpp
@@ -0,0 +1,33 @@
+// RUN: %clang_cc1 -fsyntax-only -Wc++0x-compat -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+
+// Verify that the appropriate fixits are emitted for narrowing conversions in
+// initializer lists.
+
+typedef short int16_t;
+
+void fixits() {
+ int x = 999;
+ struct {char c;} c2 = {x};
+ // CHECK: warning:{{.*}} cannot be narrowed
+ // CHECK: fix-it:{{.*}}:26}:"static_cast<char>("
+ // CHECK: fix-it:{{.*}}:27}:")"
+ struct {int16_t i;} i16 = {70000};
+ // CHECK: warning:{{.*}} cannot be narrowed
+ // CHECK: fix-it:{{.*}}:30}:"static_cast<int16_t>("
+ // CHECK: fix-it:{{.*}}:35}:")"
+}
+
+template<typename T>
+void maybe_shrink_int(T t) {
+ struct {T t;} t2 = {700};
+}
+
+void test_template() {
+ maybe_shrink_int((char)3);
+ // CHECK: warning:{{.*}} cannot be narrowed
+ // CHECK: note:{{.*}} in instantiation
+ // CHECK: note:{{.*}} override
+ // FIXME: This should be static_cast<T>.
+ // CHECK: fix-it:{{.*}}"static_cast<char>("
+ // CHECK: fix-it:{{.*}}")"
+}
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
new file mode 100644
index 000000000000..2294a4eb0894
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.list/p7-0x.cpp
@@ -0,0 +1,175 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -triple x86_64-apple-macosx10.6.7 -verify %s
+
+// Verify that narrowing conversions in initializer lists cause errors in C++0x
+// mode.
+
+void std_example() {
+ int x = 999; // x is not a constant expression
+ const int y = 999;
+ const int z = 99;
+ char c1 = x; // OK, though it might narrow (in this case, it does narrow)
+ char c2{x}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ char c3{y}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}}
+ char c4{z}; // OK: no narrowing needed
+ unsigned char uc1 = {5}; // OK: no narrowing needed
+ unsigned char uc2 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ unsigned int ui1 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ signed int si1 =
+ { (unsigned int)-1 }; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ int ii = {2.0}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ float f1 { x }; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ float f2 { 7 }; // OK: 7 can be exactly represented as a float
+ int f(int);
+ int a[] =
+ { 2, f(2), f(2.0) }; // OK: the double-to-int conversion is not at the top level
+}
+
+// Test each rule individually.
+
+template<typename T>
+struct Agg {
+ T t;
+};
+
+// C++0x [dcl.init.list]p7: A narrowing conversion is an implicit conversion
+//
+// * from a floating-point type to an integer type, or
+
+void float_to_int() {
+ Agg<char> a1 = {1.0F}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<char> a2 = {1.0}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<char> a3 = {1.0L}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+
+ float f = 1.0;
+ double d = 1.0;
+ long double ld = 1.0;
+ Agg<char> a4 = {f}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<char> a5 = {d}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<char> a6 = {ld}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+}
+
+// * from long double to double or float, or from double to float, except where
+// the source is a constant expression and the actual value after conversion
+// is within the range of values that can be represented (even if it cannot be
+// represented exactly), or
+
+void shrink_float() {
+ // These aren't constant expressions.
+ float f = 1.0;
+ double d = 1.0;
+ long double ld = 1.0;
+
+ // Variables.
+ Agg<float> f1 = {f}; // OK (no-op)
+ Agg<float> f2 = {d}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<float> f3 = {ld}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ // Exact constants.
+ Agg<float> f4 = {1.0}; // OK (double constant represented exactly)
+ Agg<float> f5 = {1.0L}; // OK (long double constant represented exactly)
+ // Inexact but in-range constants.
+ Agg<float> f6 = {0.1}; // OK (double constant in range but rounded)
+ Agg<float> f7 = {0.1L}; // OK (long double constant in range but rounded)
+ // Out of range constants.
+ Agg<float> f8 = {1E50}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<float> f9 = {1E50L}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ // More complex constant expression.
+ constexpr long double e40 = 1E40L, e30 = 1E30L, e39 = 1E39L;
+ Agg<float> f10 = {e40 - 5 * e39 + e30 - 5 * e39}; // OK
+
+ // Variables.
+ Agg<double> d1 = {f}; // OK (widening)
+ Agg<double> d2 = {d}; // OK (no-op)
+ Agg<double> d3 = {ld}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ // Exact constant.
+ Agg<double> d4 = {1.0L}; // OK (long double constant represented exactly)
+ // Inexact but in-range constant.
+ Agg<double> d5 = {0.1L}; // OK (long double constant in range but rounded)
+ // Out of range constant.
+ Agg<double> d6 = {1E315L}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ // More complex constant expression.
+ constexpr long double e315 = 1E315L, e305 = 1E305L, e314 = 1E314L;
+ Agg<double> d7 = {e315 - 5 * e314 + e305 - 5 * e314}; // OK
+}
+
+// * from an integer type or unscoped enumeration type to a floating-point type,
+// except where the source is a constant expression and the actual value after
+// conversion will fit into the target type and will produce the original
+// value when converted back to the original type, or
+void int_to_float() {
+ // Not a constant expression.
+ char c = 1;
+
+ // Variables. Yes, even though all char's will fit into any floating type.
+ Agg<float> f1 = {c}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<double> f2 = {c}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<long double> f3 = {c}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+
+ // Constants.
+ Agg<float> f4 = {12345678}; // OK (exactly fits in a float)
+ Agg<float> f5 = {123456789}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+}
+
+// * from an integer type or unscoped enumeration type to an integer type that
+// cannot represent all the values of the original type, except where the
+// source is a constant expression and the actual value after conversion will
+// fit into the target type and will produce the original value when converted
+// back to the original type.
+void shrink_int() {
+ // Not a constant expression.
+ short s = 1;
+ unsigned short us = 1;
+ Agg<char> c1 = {s}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<unsigned short> s1 = {s}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<short> s2 = {us}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+
+ // "that cannot represent all the values of the original type" means that the
+ // validity of the program depends on the relative sizes of integral types.
+ // This test compiles with -m64, so sizeof(int)<sizeof(long)==sizeof(long
+ // long).
+ long l1 = 1;
+ Agg<int> i1 = {l1}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ long long ll = 1;
+ Agg<long> l2 = {ll}; // OK
+
+ // Constants.
+ Agg<char> c2 = {127}; // OK
+ Agg<char> c3 = {300}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}}
+
+ Agg<int> i2 = {0x7FFFFFFFU}; // OK
+ Agg<int> i3 = {0x80000000U}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<unsigned int> i4 = {-0x80000000L}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+
+ // Bool is also an integer type, but conversions to it are a different AST
+ // node.
+ Agg<bool> b1 = {0}; // OK
+ Agg<bool> b2 = {1}; // OK
+ Agg<bool> b3 = {-1}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+
+ // Conversions from pointers to booleans aren't narrowing conversions.
+ Agg<bool> b = {&b1}; // OK
+}
+
+// Be sure that type- and value-dependent expressions in templates get the error
+// too.
+
+template<int I, typename T>
+void maybe_shrink_int(T t) {
+ Agg<short> s1 = {t}; // expected-error {{ cannot be narrowed }} expected-note {{override}}
+ Agg<short> s2 = {I}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}}
+ Agg<T> t2 = {700}; // expected-error {{ cannot be narrowed }} expected-note {{override}} expected-warning {{changes value}}
+}
+
+void test_template() {
+ maybe_shrink_int<15>((int)3); // expected-note {{in instantiation}}
+ maybe_shrink_int<70000>((char)3); // expected-note {{in instantiation}}
+}
+
+
+// We don't want qualifiers on the types in the diagnostic.
+
+void test_qualifiers(int i) {
+ const int j = i;
+ struct {const unsigned char c;} c1 = {j}; // expected-error {{from type 'int' to 'unsigned char' in}} expected-note {{override}}
+ // Template arguments make it harder to avoid printing qualifiers:
+ Agg<const unsigned char> c2 = {j}; // expected-error {{from type 'int' to 'const unsigned char' in}} expected-note {{override}}
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp
index bd08ab5423b0..20c059eab6f3 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
int g(int);
void f() {
int i;
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 7b0fb9c52ba4..95cc56cbab53 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
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify -pedantic %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify -pedantic %s
// Test the C++0x-specific reference initialization rules, e.g., the
// rules for rvalue references.
@@ -17,7 +17,7 @@ int f(int);
template<typename T>
struct ConvertsTo {
- operator T(); // expected-note 4{{candidate function}}
+ operator T(); // expected-note 2{{candidate function}}
};
void test_rvalue_refs() {
@@ -132,7 +132,9 @@ namespace std_example_2 {
namespace argument_passing {
void base_rvalue_ref(Base&&);
- void int_rvalue_ref(int&&); // expected-note 2{{passing argument to parameter here}}
+ void int_rvalue_ref(int&&); // expected-note{{candidate function not viable: no known conversion from 'ConvertsTo<int &>' to 'int &&' for 1st argument}} \
+ // expected-note{{candidate function not viable: no known conversion from 'ConvertsTo<float &>' to 'int &&' for 1st argument}}
+
void array_rvalue_ref(int (&&)[5]);
void function_rvalue_ref(int (&&)(int));
@@ -157,8 +159,36 @@ namespace argument_passing {
function_rvalue_ref(ConvertsTo<int(&)(int)>());
- int_rvalue_ref(ConvertsTo<int&>()); // expected-error{{no viable conversion from 'ConvertsTo<int &>' to 'int'}}
- int_rvalue_ref(ConvertsTo<float&>()); // expected-error{{no viable conversion from 'ConvertsTo<float &>' to 'int'}}
+ int_rvalue_ref(ConvertsTo<int&>()); // expected-error{{no matching function for call to 'int_rvalue_ref'}}
+ int_rvalue_ref(ConvertsTo<float&>()); // expected-error{{no matching function for call to 'int_rvalue_ref'}}
}
}
+
+namespace pr10644 {
+ struct string {
+ string(const char* __s);
+ };
+ class map {
+ int& operator[](const string& __k);
+ public:
+ int& operator[](const string&& __k);
+ };
+ void foo() {
+ static map key_map;
+ key_map["line"];
+ }
+}
+
+namespace PR11003 {
+ class Value {
+ };
+ struct MoveRef {
+ operator Value &() const ;
+ };
+ MoveRef Move(int);
+ void growTo() {
+ Value x = Move(0);
+ Value y(Move(0));
+ }
+}
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
index 5cfb11a1fc1b..27eb6d1c078f 100644
--- a/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.ref/p5-cxx0x-no-extra-copy.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// C++03 requires that we check for a copy constructor when binding a
// reference to a reference-compatible rvalue, since we are allowed to
diff --git a/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp
new file mode 100644
index 000000000000..07a5cef30478
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.init/dcl.init.string/p1.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+char x1[]("hello");
+extern char x1[6];
+
+char x2[] = "hello";
+extern char x2[6];
diff --git a/test/CXX/dcl.decl/dcl.init/p14-0x.cpp b/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
index e5b58899545c..419f2bff1282 100644
--- a/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.init/p14-0x.cpp
@@ -1,10 +1,10 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct NoDefault {
NoDefault() = delete; // expected-note {{here}}
NoDefault(int);
};
-struct Explicit { // expected-note {{candidate}} expected-note {{here}}
+struct Explicit { // expected-note 2 {{candidate}} expected-note {{here}}
explicit Explicit(int);
};
struct NoCopy {
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
index b0575b8236bb..102746c3db29 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.array/p1-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
void f() {
int b[5];
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp
index 9d26561ca8de..385e45dadfae 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct.default/p10.cpp
@@ -5,7 +5,7 @@ struct A {
};
struct B : public A {
- void f(int a);
+ void f(int a); // expected-note{{'f' declared here}}
};
void m() {
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 b2129b259bb3..f3dec52f63b3 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
@@ -41,7 +41,7 @@ namespace N1 {
void m()
{
- void f(int, int);
+ void f(int, int); // expected-note{{'f' declared here}}
f(4); // expected-error{{too few arguments to function call}}
void f(int, int = 5); // expected-note{{previous definition}}
f(4); // okay
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
new file mode 100644
index 000000000000..a87982906631
--- /dev/null
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/dcl.fct.def.default/p2.cpp
@@ -0,0 +1,62 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+// FIXME: test with non-std qualifiers
+
+namespace move {
+ struct Const {
+ Const(const Const&&) = default; // expected-error {{the parameter for an explicitly-defaulted move constructor may not be const}}
+ Const& operator=(const Const&&) = default; // expected-error {{the parameter for an explicitly-defaulted move assignment operator may not be const}}
+ };
+
+ struct Volatile {
+ Volatile(volatile Volatile&&) = default; // expected-error {{the parameter for an explicitly-defaulted move constructor may not be volatile}}
+ Volatile& operator=(volatile Volatile&&) = default; // expected-error {{the parameter for an explicitly-defaulted move assignment operator may not be volatile}}
+ };
+
+ struct AssignmentRet1 {
+ AssignmentRet1&& operator=(AssignmentRet1&&) = default; // expected-error {{an explicitly-defaulted move assignment operator must return an unqualified lvalue reference to its class type}}
+ };
+
+ struct AssignmentRet2 {
+ const AssignmentRet2& operator=(AssignmentRet2&&) = default; // expected-error {{an explicitly-defaulted move assignment operator must return an unqualified lvalue reference to its class type}}
+ };
+
+ struct ConstAssignment {
+ ConstAssignment& operator=(ConstAssignment&&) const = default; // expected-error {{an explicitly-defaulted move assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}
+ };
+}
+
+namespace copy {
+ struct Volatile {
+ Volatile(const volatile Volatile&) = default; // expected-error {{the parameter for an explicitly-defaulted copy constructor may not be volatile}}
+ Volatile& operator=(const volatile Volatile&) = default; // expected-error {{the parameter for an explicitly-defaulted copy assignment operator may not be volatile}}
+ };
+
+ struct Const {
+ Const(const Const&) = default;
+ Const& operator=(const Const&) = default;
+ };
+
+ struct NonConst {
+ NonConst(NonConst&) = default;
+ NonConst& operator=(NonConst&) = default;
+ };
+
+ struct BadConst {
+ NonConst nc; // makes implicit copy non-const
+ BadConst(const BadConst&) = default; // expected-error {{is const, but}}
+ BadConst& operator=(const BadConst&) = default; // expected-error {{is const, but}}
+ };
+
+ struct AssignmentRet1 {
+ AssignmentRet1&& operator=(const AssignmentRet1&) = default; // expected-error {{an explicitly-defaulted copy assignment operator must return an unqualified lvalue reference to its class type}}
+ };
+
+ struct AssignmentRet2 {
+ const AssignmentRet2& operator=(const AssignmentRet2&) = default; // expected-error {{an explicitly-defaulted copy assignment operator must return an unqualified lvalue reference to its class type}}
+ };
+
+ struct ConstAssignment {
+ ConstAssignment& operator=(const ConstAssignment&) const = default; // expected-error {{an explicitly-defaulted copy assignment operator may not have 'const', 'constexpr' or 'volatile' qualifiers}}
+ };
+}
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 868d009003ee..19a5f23e3f17 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p13.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fcxx-exceptions -fexceptions -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fcxx-exceptions -fexceptions -verify %s
// When it is part of a parameter-declaration-clause, the parameter
// pack is a function parameter pack.
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 1293a067576a..0e69521fbdfc 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p14.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> struct identity;
template<typename ...Types> struct tuple;
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
index 70c9aeb48819..6b1f3e438d8f 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p2-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
auto a() -> int; // ok
const auto b() -> int; // expected-error {{function with trailing return type must specify return type 'auto', not 'auto const'}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
index c81c844f3448..ce0a082462a2 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p6-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
void f0() &; // expected-error{{ref-qualifier '&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
void f1() &&; // expected-error{{ref-qualifier '&&' is only allowed on non-static member functions, member function pointers, and typedefs of function types}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp
index 21efbfff1ab9..11926f1bd6cb 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p8-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
auto f() -> int[32]; // expected-error{{function cannot return array}}
auto g() -> int(int); // expected-error{{function cannot return function}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
index ca4701554be4..4d71a8e4b4c6 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.fct/p9-0x.cpp
@@ -1,3 +1,3 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
auto j() -> enum { e3 }; // expected-error{{can not be defined in a type specifier}}
diff --git a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
index 789cde75241a..4ce80bc35ac9 100644
--- a/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
+++ b/test/CXX/dcl.decl/dcl.meaning/dcl.ref/p6-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T, typename U>
struct is_same {
diff --git a/test/CXX/dcl.decl/p4-0x.cpp b/test/CXX/dcl.decl/p4-0x.cpp
index 9fa2ea19d411..98c33b25f4d2 100644
--- a/test/CXX/dcl.decl/p4-0x.cpp
+++ b/test/CXX/dcl.decl/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct X {
void f() &;
diff --git a/test/CXX/except/except.spec/canonical.cpp b/test/CXX/except/except.spec/canonical.cpp
index 9bc26de14440..81ca2ae0a20e 100644
--- a/test/CXX/except/except.spec/canonical.cpp
+++ b/test/CXX/except/except.spec/canonical.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// PR10087: Make sure that we don't conflate exception specifications
// from different functions in the canonical type system.
diff --git a/test/CXX/except/except.spec/p1.cpp b/test/CXX/except/except.spec/p1.cpp
index 86924bb49d75..a6e785024778 100644
--- a/test/CXX/except/except.spec/p1.cpp
+++ b/test/CXX/except/except.spec/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Simple parser tests, dynamic specification.
@@ -60,14 +60,22 @@ namespace noex {
}
namespace noexcept_unevaluated {
- template<typename T> void f(T) {
+ template<typename T> bool f(T) {
T* x = 1;
}
template<typename T>
- void g(T x) noexcept((f(x), sizeof(T) == 4)) { }
+ void g(T x) noexcept((sizeof(T) == sizeof(int)) || f(x)) { }
void h() {
g(1);
}
}
+
+namespace PR11084 {
+ template<int X> struct A {
+ static int f() noexcept(1/X) { return 10; } // expected-error{{argument to noexcept specifier must be a constant expression}}
+ };
+
+ void g() { A<0>::f(); } // expected-note{{in instantiation of template class 'PR11084::A<0>' requested here}}
+}
diff --git a/test/CXX/except/except.spec/p11.cpp b/test/CXX/except/except.spec/p11.cpp
index 268b53ad79d0..0e4fad53e350 100644
--- a/test/CXX/except/except.spec/p11.cpp
+++ b/test/CXX/except/except.spec/p11.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// This is the "let the user shoot himself in the foot" clause.
void f() noexcept {
diff --git a/test/CXX/except/except.spec/p14.cpp b/test/CXX/except/except.spec/p14.cpp
index f42fbe907ffe..8763a7028195 100644
--- a/test/CXX/except/except.spec/p14.cpp
+++ b/test/CXX/except/except.spec/p14.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -verify -std=c++0x %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -verify -std=c++11 %s
struct A { };
struct B { };
struct C { };
diff --git a/test/CXX/except/except.spec/p15.cpp b/test/CXX/except/except.spec/p15.cpp
index 2dae9623e0cc..110ec3fa0300 100644
--- a/test/CXX/except/except.spec/p15.cpp
+++ b/test/CXX/except/except.spec/p15.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Deallocation functions are implicitly noexcept.
// Thus, explicit specs aren't allowed to conflict.
diff --git a/test/CXX/except/except.spec/p2-places.cpp b/test/CXX/except/except.spec/p2-places.cpp
index db1ee77463fb..67647fb043a9 100644
--- a/test/CXX/except/except.spec/p2-places.cpp
+++ b/test/CXX/except/except.spec/p2-places.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Tests where specs are allowed and where they aren't.
diff --git a/test/CXX/except/except.spec/p3.cpp b/test/CXX/except/except.spec/p3.cpp
index 5df5f26a8f8f..d77aea40602c 100644
--- a/test/CXX/except/except.spec/p3.cpp
+++ b/test/CXX/except/except.spec/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Exception specification compatibility.
// We test function pointers, because functions have an extra rule in p4.
diff --git a/test/CXX/except/except.spec/p5-pointers.cpp b/test/CXX/except/except.spec/p5-pointers.cpp
index 171afff22b5b..dd3c0600ce92 100644
--- a/test/CXX/except/except.spec/p5-pointers.cpp
+++ b/test/CXX/except/except.spec/p5-pointers.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Assignment of function pointers.
diff --git a/test/CXX/except/except.spec/p5-virtual.cpp b/test/CXX/except/except.spec/p5-virtual.cpp
index ceea9f8f2500..69daec6ee533 100644
--- a/test/CXX/except/except.spec/p5-virtual.cpp
+++ b/test/CXX/except/except.spec/p5-virtual.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// Compatibility of virtual functions.
diff --git a/test/CXX/except/except.spec/p9-dynamic.cpp b/test/CXX/except/except.spec/p9-dynamic.cpp
index 3f496f25c9ba..4559e0d467b1 100644
--- a/test/CXX/except/except.spec/p9-dynamic.cpp
+++ b/test/CXX/except/except.spec/p9-dynamic.cpp
@@ -7,5 +7,6 @@ void target() throw(int)
// CHECK: invoke void @_Z8externalv()
external();
}
-// CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} i8* bitcast (i8** @_ZTIi to i8*)) nounwind
-// CHECK: call void @__cxa_call_unexpected
+// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+// CHECK-NEXT: filter [1 x i8*] [i8* bitcast (i8** @_ZTIi to i8*)]
+// CHECK: call void @__cxa_call_unexpected
diff --git a/test/CXX/except/except.spec/p9-noexcept.cpp b/test/CXX/except/except.spec/p9-noexcept.cpp
index 76ac66c841b9..7c8d0ef1fb44 100644
--- a/test/CXX/except/except.spec/p9-noexcept.cpp
+++ b/test/CXX/except/except.spec/p9-noexcept.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 %s -std=c++0x -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
+// RUN: %clang_cc1 %s -std=c++11 -triple=x86_64-apple-darwin10 -emit-llvm -o - -fcxx-exceptions -fexceptions | FileCheck %s
void external();
@@ -7,7 +7,8 @@ void target() noexcept
// CHECK: invoke void @_Z8externalv()
external();
}
-// CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} i8* null) nounwind
+// CHECK: landingpad { i8*, i32 } personality i8* bitcast (i32 (...)* @__gxx_personality_v0 to i8*)
+// CHECK-NEXT: catch i8* null
// CHECK-NEXT: call void @_ZSt9terminatev() noreturn nounwind
// CHECK-NEXT: unreachable
diff --git a/test/CXX/except/except.spec/template.cpp b/test/CXX/except/except.spec/template.cpp
index f8b7270344a7..805a604db588 100644
--- a/test/CXX/except/except.spec/template.cpp
+++ b/test/CXX/except/except.spec/template.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -fsyntax-only -verify %s
// We use pointer assignment compatibility to test instantiation.
diff --git a/test/CXX/expr/expr.cast/p4-0x.cpp b/test/CXX/expr/expr.cast/p4-0x.cpp
index 5824cd21f1e7..96bf5f91196b 100644
--- a/test/CXX/expr/expr.cast/p4-0x.cpp
+++ b/test/CXX/expr/expr.cast/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct X { };
struct Y : X { };
diff --git a/test/CXX/expr/expr.const/p2-0x.cpp b/test/CXX/expr/expr.const/p2-0x.cpp
index 1b38cf19b42e..2c6a46b3beaf 100644
--- a/test/CXX/expr/expr.const/p2-0x.cpp
+++ b/test/CXX/expr/expr.const/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
// PR9999
template<bool v>
diff --git a/test/CXX/expr/expr.mptr.oper/p6-0x.cpp b/test/CXX/expr/expr.mptr.oper/p6-0x.cpp
index d5dc7d2cbe58..917b2dab7c32 100644
--- a/test/CXX/expr/expr.mptr.oper/p6-0x.cpp
+++ b/test/CXX/expr/expr.mptr.oper/p6-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct X { };
diff --git a/test/CXX/expr/expr.post/expr.call/p7-0x.cpp b/test/CXX/expr/expr.post/expr.call/p7-0x.cpp
index bb4726dd3309..d51ba09835d2 100644
--- a/test/CXX/expr/expr.post/expr.call/p7-0x.cpp
+++ b/test/CXX/expr/expr.post/expr.call/p7-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct X1 {
X1();
@@ -15,3 +15,16 @@ void f(X1 x1, X2 x2) {
vararg(x1); // okay
vararg(x2); // expected-error{{cannot pass object of non-trivial type 'X2' through variadic function; call will abort at runtime}}
}
+
+
+namespace PR11131 {
+ struct S;
+
+ S &getS();
+
+ void f(...);
+
+ void g() {
+ (void)sizeof(f(getS()));
+ }
+}
diff --git a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
index d46488107ba6..6ba8d519346e 100644
--- a/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
+++ b/test/CXX/expr/expr.post/expr.const.cast/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// The result of the expression const_cast<T>(v) is of type T. If T is
// an lvalue reference to object type, the result is an lvalue; if T
diff --git a/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp
index 3b448a80db2b..cddd5cf25e3b 100644
--- a/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp
+++ b/test/CXX/expr/expr.post/expr.dynamic.cast/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct X { virtual ~X(); };
struct Y : public X { };
diff --git a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp
index e80082a0408a..22892a63ab16 100644
--- a/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp
+++ b/test/CXX/expr/expr.post/expr.reinterpret.cast/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// If T is an lvalue reference type or an rvalue reference to function
// type, the result is an lvalue; if T is an rvalue reference to
diff --git a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp
index c10335183e21..9ef15e6642b1 100644
--- a/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp
+++ b/test/CXX/expr/expr.post/expr.static.cast/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// A glvalue of type "cv1 T1" can be cast to type "rvalue reference to
// cv2 T2" if "cv2 T2" is reference-compatible with "cv1 T1" (8.5.3).
diff --git a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp
index 4acafb89acaf..731c50844428 100644
--- a/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp
+++ b/test/CXX/expr/expr.post/expr.static.cast/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
enum class EC { ec1 };
diff --git a/test/CXX/expr/expr.prim/p12-0x.cpp b/test/CXX/expr/expr.prim/p12-0x.cpp
index 0ff29a18825b..aec62ddd97a7 100644
--- a/test/CXX/expr/expr.prim/p12-0x.cpp
+++ b/test/CXX/expr/expr.prim/p12-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct S {
int *j = &nonexistent; // expected-error {{use of undeclared identifier 'nonexistent'}}
diff --git a/test/CXX/expr/expr.prim/p4-0x.cpp b/test/CXX/expr/expr.prim/p4-0x.cpp
index 13735fab4a9d..143ba897ae95 100644
--- a/test/CXX/expr/expr.prim/p4-0x.cpp
+++ b/test/CXX/expr/expr.prim/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
struct S {
S *p = this; // ok
diff --git a/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp b/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp
index c9a8887d2644..4ebbfce289ea 100644
--- a/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp
+++ b/test/CXX/expr/expr.unary/expr.new/p2-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
template<typename T>
struct only {
diff --git a/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp b/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
index 4c924b137ccd..eca1ec790199 100644
--- a/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
+++ b/test/CXX/expr/expr.unary/expr.new/p20-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x -fexceptions %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 -fexceptions %s
typedef __SIZE_TYPE__ size_t;
struct S {
diff --git a/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp b/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp
index 382461541546..afd8ef05302f 100644
--- a/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp
+++ b/test/CXX/expr/expr.unary/expr.sizeof/p5-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Test parsing + semantic analysis
template<typename ...Types> struct count_types {
diff --git a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
index 67d853a287f8..5c1029f1a3ff 100644
--- a/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.noexcept/cg.cpp
@@ -1,6 +1,6 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include %S/ser.h %s -o - | FileCheck %s
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++0x -x c++ %S/ser.h
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++0x -include-pch %t-ser.pch %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++11 -include %S/ser.h %s -o - | FileCheck %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -emit-pch -o %t-ser.pch -std=c++11 -x c++ %S/ser.h
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -triple x86_64-apple-darwin10 -S -emit-llvm -std=c++11 -include-pch %t-ser.pch %s -o - | FileCheck %s
struct D {
~D() throw();
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 6d1e523b51bf..b5de1a7f8fee 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++0x -fms-extensions %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -fsyntax-only -verify -std=c++11 -fms-extensions %s
#define P(e) static_assert(noexcept(e), "expected nothrow")
#define N(e) static_assert(!noexcept(e), "expected throw")
diff --git a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
index 30f8c5491951..ac11940c80da 100644
--- a/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
+++ b/test/CXX/expr/expr.unary/expr.unary.op/p6.cpp
@@ -29,8 +29,7 @@ bool b8 = !S(); //expected-error {{invalid argument type 'S'}}
namespace PR8181
{
- void f() { } // expected-note{{candidate function}}
- void f(char) { } // expected-note{{candidate function}}
- bool b = !&f; //expected-error {{cannot resolve overloaded function 'f' from context}}
-
+ bool f() { } // expected-note{{possible target for call}}
+ void f(char) { } // expected-note{{possible target for call}}
+ bool b = !&f; //expected-error {{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}}
}
diff --git a/test/CXX/lex/lex.literal/lex.ccon/p1.cpp b/test/CXX/lex/lex.literal/lex.ccon/p1.cpp
index 7b65f7ee8320..5342153b63ba 100644
--- a/test/CXX/lex/lex.literal/lex.ccon/p1.cpp
+++ b/test/CXX/lex/lex.literal/lex.ccon/p1.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Check types of char literals
extern char a;
@@ -7,3 +8,9 @@ extern int b;
extern __typeof('asdf') b;
extern wchar_t c;
extern __typeof(L'a') c;
+#if __cplusplus >= 201103L
+extern char16_t d;
+extern __typeof(u'a') d;
+extern char32_t e;
+extern __typeof(U'a') e;
+#endif
diff --git a/test/CXX/lex/lex.literal/lex.ext/p1.cpp b/test/CXX/lex/lex.literal/lex.ext/p1.cpp
new file mode 100644
index 000000000000..39812280c090
--- /dev/null
+++ b/test/CXX/lex/lex.literal/lex.ext/p1.cpp
@@ -0,0 +1,7 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+int * operator "" p31(long double); // expected-warning{{user-defined literal with suffix 'p31' is preempted by C99 hexfloat extension}}
+long double operator "" _p31(long double);
+long double operator "" pi(long double); // expected-warning{{user-defined literals not starting with '_' are reserved by the implementation}}
+
+float hexfloat = 0x1p31; // allow hexfloats
diff --git a/test/CXX/lex/lex.pptoken/p3-0x.cpp b/test/CXX/lex/lex.pptoken/p3-0x.cpp
index 4ae867c2095e..3d56ac17bd5b 100644
--- a/test/CXX/lex/lex.pptoken/p3-0x.cpp
+++ b/test/CXX/lex/lex.pptoken/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
int a<::> = { 1, 2, 3 };
int b = a<:::a<:0:>:>;
diff --git a/test/CXX/over/over.built/p23.cpp b/test/CXX/over/over.built/p23.cpp
new file mode 100644
index 000000000000..41255214ec6a
--- /dev/null
+++ b/test/CXX/over/over.built/p23.cpp
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+struct Variant {
+ template <typename T> operator T();
+};
+
+Variant getValue();
+
+void testVariant() {
+ bool ret1 = getValue() || getValue();
+ bool ret2 = getValue() && getValue();
+ bool ret3 = !getValue();
+}
+
+struct ExplicitVariant {
+ template <typename T> explicit operator T();
+};
+
+ExplicitVariant getExplicitValue();
+
+void testExplicitVariant() {
+ bool ret1 = getExplicitValue() || getExplicitValue();
+ bool ret2 = getExplicitValue() && getExplicitValue();
+ bool ret3 = !getExplicitValue();
+}
diff --git a/test/CXX/over/over.built/p25.cpp b/test/CXX/over/over.built/p25.cpp
index c185fb4fb96d..aea3854a420e 100644
--- a/test/CXX/over/over.built/p25.cpp
+++ b/test/CXX/over/over.built/p25.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
enum class Color { Red, Green, Blue };
diff --git a/test/CXX/over/over.load/p2-0x.cpp b/test/CXX/over/over.load/p2-0x.cpp
index f0ace9044a2d..cf38741056ab 100644
--- a/test/CXX/over/over.load/p2-0x.cpp
+++ b/test/CXX/over/over.load/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Member function declarations with the same name and the same
// parameter-type-list as well as mem- ber function template
diff --git a/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
index d9e0ff88bd8d..1c71468e453d 100644
--- a/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
+++ b/test/CXX/over/over.match/over.match.best/over.best.ics/over.ics.user/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
namespace PR6285 {
template<typename T> struct identity
diff --git a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
index ab171bc3f6f4..3971acc58169 100644
--- a/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
+++ b/test/CXX/over/over.match/over.match.best/over.ics.rank/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
namespace std_example {
int i;
int f1();
diff --git a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp
index 8ccc5b6204d0..3845af09d14c 100644
--- a/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp
+++ b/test/CXX/over/over.match/over.match.funcs/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> T &lvalue();
template<typename T> T &&xvalue();
diff --git a/test/CXX/over/over.over/p2-resolve-single-template-id.cpp b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
index 544a66d9e39a..d2a23ce96df2 100644
--- a/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
+++ b/test/CXX/over/over.over/p2-resolve-single-template-id.cpp
@@ -27,26 +27,26 @@ namespace DontAllowUnresolvedOverloadedExpressionInAnUnusedExpression
void one() { }
template<class T> void oneT() { }
- void two() { } //expected-note 2{{candidate}}
- void two(int) { } //expected-note 2{{candidate}}
- template<class T> void twoT() { } //expected-note 2{{candidate}}
- template<class T> void twoT(T) { } //expected-note 2{{candidate}}
+ void two() { } // expected-note 2 {{possible target for call}}
+ void two(int) { } // expected-note 2 {{possible target for call}}
+ template<class T> void twoT() { } // expected-note 2 {{possible target for call}}
+ template<class T> void twoT(T) { } // expected-note 2 {{possible target for call}}
void check()
{
one; // expected-warning {{expression result unused}}
- two; // expected-error{{cannot resolve overloaded function 'two' from context}}
+ two; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}}
oneT<int>; // expected-warning {{expression result unused}}
- twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ twoT<int>; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
}
// check the template function case
template<class T> void check()
{
one; // expected-warning {{expression result unused}}
- two; // expected-error{{cannot resolve overloaded function 'two' from context}}
+ two; // expected-error{{reference to overloaded function could not be resolved; did you mean to call it with no arguments?}}
oneT<int>; // expected-warning {{expression result unused}}
- twoT<int>; // expected-error {{cannot resolve overloaded function 'twoT' from context}}
+ twoT<int>; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
}
@@ -128,8 +128,8 @@ namespace member_pointers {
template <typename T> bool f(T) { return false; }
template <typename T> static bool g(T) { return false; }
- template <typename T> bool h(T) { return false; }
- template <int N> static bool h(int) { return false; }
+ template <typename T> bool h(T) { return false; } // expected-note 3 {{possible target for call}}
+ template <int N> static bool h(int) { return false; } // expected-note 3 {{possible target for call}}
};
void test(S s) {
@@ -137,8 +137,8 @@ namespace member_pointers {
if (S::f<int>) return; // expected-error {{call to non-static member function without an object argument}}
if (&S::f<char>) return;
if (&S::f<int>) return;
- if (s.f<char>) return; // expected-error {{a bound member function may only be called}}
- if (s.f<int>) return; // expected-error {{a bound member function may only be called}}
+ if (s.f<char>) return; // expected-error {{reference to non-static member function must be called}}
+ if (s.f<int>) return; // expected-error {{reference to non-static member function must be called}}
if (&s.f<char>) return; // expected-error {{cannot create a non-constant pointer to member function}}
if (&s.f<int>) return; // expected-error {{cannot create a non-constant pointer to member function}}
@@ -152,13 +152,13 @@ namespace member_pointers {
if (&s.g<int>) return;
if (S::h<42>) return;
- if (S::h<int>) return; // expected-error {{a bound member function may only be called}}
+ if (S::h<int>) return; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
if (&S::h<42>) return;
if (&S::h<int>) return;
if (s.h<42>) return;
- if (s.h<int>) return; // expected-error {{a bound member function may only be called}}
+ if (s.h<int>) return; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
if (&s.h<42>) return;
- if (&s.h<int>) return; // expected-error {{a bound member function may only be called}}
+ if (&s.h<int>) return; // expected-error {{reference to overloaded function could not be resolved; did you mean to call it?}}
{ bool b = S::f<char>; } // expected-error {{call to non-static member function without an object argument}}
{ bool b = S::f<int>; } // expected-error {{call to non-static member function without an object argument}}
diff --git a/test/CXX/special/class.copy/implicit-move-def.cpp b/test/CXX/special/class.copy/implicit-move-def.cpp
new file mode 100644
index 000000000000..94023cbc1d7b
--- /dev/null
+++ b/test/CXX/special/class.copy/implicit-move-def.cpp
@@ -0,0 +1,116 @@
+// RUN: %clang_cc1 -emit-llvm -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-ASSIGN %s
+// RUN: %clang_cc1 -emit-llvm -o - -std=c++11 %s | FileCheck -check-prefix=CHECK-CTOR %s
+
+// construct
+
+struct E {
+ E();
+ E(E&&);
+};
+
+struct F {
+ F();
+ F(F&&);
+};
+
+struct G {
+ E e;
+};
+
+struct H : G {
+ F l;
+ E m;
+ F ar[2];
+};
+
+void f() {
+ H s;
+ // CHECK: call void @_ZN1HC1EOS_
+ H t(static_cast<H&&>(s));
+}
+
+
+// assign
+
+struct A {
+ A &operator =(A&&);
+};
+
+struct B {
+ B &operator =(B&&);
+};
+
+struct C {
+ A a;
+};
+
+struct D : C {
+ A a;
+ B b;
+ A ar[2];
+};
+
+void g() {
+ D d;
+ // CHECK: call {{.*}} @_ZN1DaSEOS_
+ d = D();
+}
+
+// PR10822
+struct I {
+ unsigned var[1];
+};
+
+// CHECK: define void @_Z1hv() nounwind {
+void h() {
+ I i;
+ // CHECK: call void @llvm.memcpy.
+ i = I();
+ // CHECK-NEXT: ret void
+}
+
+// PR10860
+struct Empty { };
+struct VirtualWithEmptyBase : Empty {
+ virtual void f();
+};
+
+// CHECK: define void @_Z25move_VirtualWithEmptyBaseR20VirtualWithEmptyBaseS0_
+void move_VirtualWithEmptyBase(VirtualWithEmptyBase &x, VirtualWithEmptyBase &y) {
+ // CHECK: call {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_
+ x = static_cast<VirtualWithEmptyBase&&>(y);
+ // CHECK-NEXT: ret void
+}
+
+// move assignment ops
+
+// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1DaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1CaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1BaSEOS_
+// array loop
+// CHECK-ASSIGN: br i1
+// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
+
+// VirtualWithEmptyBase move assignment operatpr
+// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN20VirtualWithEmptyBaseaSEOS_
+// CHECK-ASSIGN: store
+// CHECK-ASSIGN-NEXT: store
+// CHECK-NOT: call
+// CHECK: ret
+
+// CHECK-ASSIGN: define linkonce_odr {{.*}} @_ZN1CaSEOS_
+// CHECK-ASSIGN: call {{.*}} @_ZN1AaSEOS_
+
+// move ctors
+
+// CHECK-CTOR: define linkonce_odr void @_ZN1HC2EOS_
+// CHECK-CTOR: call void @_ZN1GC2EOS_
+// CHECK-CTOR: call void @_ZN1FC1EOS_
+// CHECK-CTOR: call void @_ZN1EC1EOS_
+// array loop
+// CHECK-CTOR: br i1
+// CHECK-CTOR: call void @_ZN1FC1EOS_
+
+// CHECK-CTOR: define linkonce_odr void @_ZN1GC2EOS_
+// CHECK-CTOR: call void @_ZN1EC1EOS_
diff --git a/test/CXX/special/class.copy/implicit-move.cpp b/test/CXX/special/class.copy/implicit-move.cpp
new file mode 100644
index 000000000000..74f7eee9ee89
--- /dev/null
+++ b/test/CXX/special/class.copy/implicit-move.cpp
@@ -0,0 +1,164 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+
+// Tests for implicit (non-)declaration of move constructor and
+// assignment: p9, p11, p20, p23.
+
+// This class, used as a member, allows to distinguish move from copy because
+// move operations are no-throw, copy operations aren't.
+struct ThrowingCopy {
+ ThrowingCopy() noexcept;
+ ThrowingCopy(ThrowingCopy &&) noexcept;
+ ThrowingCopy(const ThrowingCopy &) noexcept(false);
+ ThrowingCopy & operator =(ThrowingCopy &&) noexcept;
+ ThrowingCopy & operator =(const ThrowingCopy &) noexcept(false);
+};
+
+struct HasCopyConstructor {
+ ThrowingCopy tc;
+ HasCopyConstructor() noexcept;
+ HasCopyConstructor(const HasCopyConstructor &) noexcept(false);
+};
+
+struct HasCopyAssignment {
+ ThrowingCopy tc;
+ HasCopyAssignment() noexcept;
+ HasCopyAssignment & operator =(const HasCopyAssignment &) noexcept(false);
+};
+
+struct HasMoveConstructor { // expected-note {{implicit copy assignment}}
+ ThrowingCopy tc;
+ HasMoveConstructor() noexcept;
+ HasMoveConstructor(HasMoveConstructor &&) noexcept;
+};
+
+struct HasMoveAssignment { // expected-note {{implicit copy constructor}}
+ ThrowingCopy tc;
+ HasMoveAssignment() noexcept;
+ HasMoveAssignment & operator =(HasMoveAssignment &&) noexcept;
+};
+
+struct HasDestructor {
+ ThrowingCopy tc;
+ HasDestructor() noexcept;
+ ~HasDestructor() noexcept;
+};
+
+void test_basic_exclusion() {
+ static_assert(!noexcept(HasCopyConstructor((HasCopyConstructor()))), "");
+ HasCopyConstructor hcc;
+ static_assert(!noexcept(hcc = HasCopyConstructor()), "");
+
+ static_assert(!noexcept(HasCopyAssignment((HasCopyAssignment()))), "");
+ HasCopyAssignment hca;
+ static_assert(!noexcept(hca = HasCopyAssignment()), "");
+
+ static_assert(noexcept(HasMoveConstructor((HasMoveConstructor()))), "");
+ HasMoveConstructor hmc;
+ hmc = HasMoveConstructor(); // expected-error {{selected deleted operator}}
+
+ (HasMoveAssignment(HasMoveAssignment())); // expected-error {{uses deleted function}}
+ HasMoveAssignment hma;
+ static_assert(noexcept(hma = HasMoveAssignment()), "");
+
+ static_assert(!noexcept(HasDestructor((HasDestructor()))), "");
+ HasDestructor hd;
+ static_assert(!noexcept(hd = HasDestructor()), "");
+}
+
+struct PrivateMove {
+ PrivateMove() noexcept;
+ PrivateMove(const PrivateMove &) noexcept(false);
+ PrivateMove & operator =(const PrivateMove &) noexcept(false);
+private:
+ PrivateMove(PrivateMove &&) noexcept;
+ PrivateMove & operator =(PrivateMove &&) noexcept;
+};
+
+struct InheritsPrivateMove : PrivateMove {};
+struct ContainsPrivateMove {
+ PrivateMove pm;
+};
+
+struct PrivateDestructor {
+ PrivateDestructor() noexcept;
+ PrivateDestructor(const PrivateDestructor &) noexcept(false);
+ PrivateDestructor(PrivateDestructor &&) noexcept;
+private:
+ ~PrivateDestructor() noexcept;
+};
+
+struct InheritsPrivateDestructor : PrivateDestructor {}; // expected-note {{explicitly marked deleted}}
+struct ContainsPrivateDestructor { // expected-note {{explicitly marked deleted}}
+ PrivateDestructor pd;
+};
+
+struct NonTrivialCopyOnly {
+ NonTrivialCopyOnly() noexcept;
+ NonTrivialCopyOnly(const NonTrivialCopyOnly &) noexcept(false);
+ NonTrivialCopyOnly & operator =(const NonTrivialCopyOnly &) noexcept(false);
+};
+
+struct InheritsNonTrivialCopyOnly : NonTrivialCopyOnly {};
+struct ContainsNonTrivialCopyOnly {
+ NonTrivialCopyOnly ntco;
+};
+
+struct ContainsConst {
+ const int i;
+ ContainsConst() noexcept;
+ ContainsConst & operator =(ContainsConst &); // expected-note {{not viable}}
+};
+
+struct ContainsRef {
+ int &i;
+ ContainsRef() noexcept;
+ ContainsRef & operator =(ContainsRef &); // expected-note {{not viable}}
+};
+
+struct Base {
+ Base & operator =(Base &);
+};
+struct DirectVirtualBase : virtual Base {}; // expected-note {{copy assignment operator) not viable}}
+struct IndirectVirtualBase : DirectVirtualBase {}; // expected-note {{copy assignment operator) not viable}}
+
+void test_deletion_exclusion() {
+ // FIXME: How to test the union thing?
+
+ static_assert(!noexcept(InheritsPrivateMove(InheritsPrivateMove())), "");
+ static_assert(!noexcept(ContainsPrivateMove(ContainsPrivateMove())), "");
+ InheritsPrivateMove ipm;
+ static_assert(!noexcept(ipm = InheritsPrivateMove()), "");
+ ContainsPrivateMove cpm;
+ static_assert(!noexcept(cpm = ContainsPrivateMove()), "");
+
+ (InheritsPrivateDestructor(InheritsPrivateDestructor())); // expected-error {{call to deleted constructor}}
+ (ContainsPrivateDestructor(ContainsPrivateDestructor())); // expected-error {{call to deleted constructor}}
+
+ static_assert(!noexcept(InheritsNonTrivialCopyOnly(InheritsNonTrivialCopyOnly())), "");
+ static_assert(!noexcept(ContainsNonTrivialCopyOnly(ContainsNonTrivialCopyOnly())), "");
+ InheritsNonTrivialCopyOnly intco;
+ static_assert(!noexcept(intco = InheritsNonTrivialCopyOnly()), "");
+ ContainsNonTrivialCopyOnly cntco;
+ static_assert(!noexcept(cntco = ContainsNonTrivialCopyOnly()), "");
+
+ ContainsConst cc;
+ cc = ContainsConst(); // expected-error {{no viable}}
+
+ ContainsRef cr;
+ cr = ContainsRef(); // expected-error {{no viable}}
+
+ DirectVirtualBase dvb;
+ dvb = DirectVirtualBase(); // expected-error {{no viable}}
+
+ IndirectVirtualBase ivb;
+ ivb = IndirectVirtualBase(); // expected-error {{no viable}}
+}
+
+struct ContainsRValueRef {
+ int&& ri;
+ ContainsRValueRef() noexcept;
+};
+
+void test_contains_rref() {
+ (ContainsRValueRef(ContainsRValueRef()));
+}
diff --git a/test/CXX/special/class.copy/p11.0x.copy.cpp b/test/CXX/special/class.copy/p11.0x.copy.cpp
new file mode 100644
index 000000000000..752872adb9f5
--- /dev/null
+++ b/test/CXX/special/class.copy/p11.0x.copy.cpp
@@ -0,0 +1,90 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+struct NonTrivial {
+ NonTrivial(const NonTrivial&);
+};
+
+union DeletedNTVariant { // expected-note{{here}}
+ NonTrivial NT;
+ DeletedNTVariant();
+};
+DeletedNTVariant DVa;
+DeletedNTVariant DVb(DVa); // expected-error{{call to deleted constructor}}
+
+struct DeletedNTVariant2 { // expected-note{{here}}
+ union {
+ NonTrivial NT;
+ };
+ DeletedNTVariant2();
+};
+DeletedNTVariant2 DV2a;
+DeletedNTVariant2 DV2b(DV2a); // expected-error{{call to deleted constructor}}
+
+struct NoAccess {
+ NoAccess() = default;
+private:
+ NoAccess(const NoAccess&);
+
+ friend struct HasAccess;
+};
+
+struct HasNoAccess { // expected-note{{here}}
+ NoAccess NA;
+};
+HasNoAccess HNAa;
+HasNoAccess HNAb(HNAa); // expected-error{{call to deleted constructor}}
+
+struct HasAccess {
+ NoAccess NA;
+};
+
+HasAccess HAa;
+HasAccess HAb(HAa);
+
+struct NonConst {
+ NonConst(NonConst&);
+};
+struct Ambiguity {
+ Ambiguity(const Ambiguity&);
+ Ambiguity(volatile Ambiguity&);
+};
+
+struct IsAmbiguous { // expected-note{{here}}
+ NonConst NC;
+ Ambiguity A;
+ IsAmbiguous();
+};
+IsAmbiguous IAa;
+IsAmbiguous IAb(IAa); // expected-error{{call to deleted constructor}}
+
+struct Deleted { // expected-note{{here}}
+ IsAmbiguous IA;
+};
+Deleted Da;
+Deleted Db(Da); // expected-error{{call to deleted constructor}}
+
+struct NoAccessDtor {
+private:
+ ~NoAccessDtor();
+ friend struct HasAccessDtor;
+};
+
+struct HasNoAccessDtor { // expected-note{{here}}
+ NoAccessDtor NAD;
+ HasNoAccessDtor();
+ ~HasNoAccessDtor();
+};
+HasNoAccessDtor HNADa;
+HasNoAccessDtor HNADb(HNADa); // expected-error{{call to deleted constructor}}
+
+struct HasAccessDtor {
+ NoAccessDtor NAD;
+};
+HasAccessDtor HADa;
+HasAccessDtor HADb(HADa);
+
+struct RValue { // expected-note{{here}}
+ int && ri = 1;
+};
+RValue RVa;
+RValue RVb(RVa); // expected-error{{call to deleted constructor}}
diff --git a/test/CXX/special/class.copy/p11.0x.move.cpp b/test/CXX/special/class.copy/p11.0x.move.cpp
new file mode 100644
index 000000000000..402bc31d5eec
--- /dev/null
+++ b/test/CXX/special/class.copy/p11.0x.move.cpp
@@ -0,0 +1,85 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+struct NonTrivial {
+ NonTrivial(NonTrivial&&);
+};
+
+union DeletedNTVariant {
+ NonTrivial NT;
+ DeletedNTVariant(DeletedNTVariant&&);
+};
+DeletedNTVariant::DeletedNTVariant(DeletedNTVariant&&) = default; // expected-error{{would delete}}
+
+struct DeletedNTVariant2 {
+ union {
+ NonTrivial NT;
+ };
+ DeletedNTVariant2(DeletedNTVariant2&&);
+};
+DeletedNTVariant2::DeletedNTVariant2(DeletedNTVariant2&&) = default; // expected-error{{would delete}}
+
+struct NoAccess {
+ NoAccess() = default;
+private:
+ NoAccess(NoAccess&&);
+
+ friend struct HasAccess;
+};
+
+struct HasNoAccess {
+ NoAccess NA;
+ HasNoAccess(HasNoAccess&&);
+};
+HasNoAccess::HasNoAccess(HasNoAccess&&) = default; // expected-error{{would delete}}
+
+struct HasAccess {
+ NoAccess NA;
+ HasAccess(HasAccess&&);
+};
+HasAccess::HasAccess(HasAccess&&) = default;
+
+struct NoAccessDtor {
+ NoAccessDtor(NoAccessDtor&&);
+private:
+ ~NoAccessDtor();
+ friend struct HasAccessDtor;
+};
+
+struct HasNoAccessDtor {
+ NoAccessDtor NAD;
+ HasNoAccessDtor(HasNoAccessDtor&&);
+};
+HasNoAccessDtor::HasNoAccessDtor(HasNoAccessDtor&&) = default; // expected-error{{would delete}}
+
+struct HasAccessDtor {
+ NoAccessDtor NAD;
+ HasAccessDtor(HasAccessDtor&&);
+};
+HasAccessDtor::HasAccessDtor(HasAccessDtor&&) = default;
+
+struct RValue {
+ int &&ri = 1;
+ RValue(RValue&&);
+};
+RValue::RValue(RValue&&) = default;
+
+struct CopyOnly {
+ CopyOnly(const CopyOnly&);
+};
+
+struct NonMove {
+ CopyOnly CO;
+ NonMove(NonMove&&);
+};
+NonMove::NonMove(NonMove&&) = default; // expected-error{{would delete}}
+
+struct Moveable {
+ Moveable();
+ Moveable(Moveable&&);
+};
+
+struct HasMove {
+ Moveable M;
+ HasMove(HasMove&&);
+};
+HasMove::HasMove(HasMove&&) = default;
diff --git a/test/CXX/special/class.copy/p15-0x.cpp b/test/CXX/special/class.copy/p15-0x.cpp
new file mode 100644
index 000000000000..32b2714fd702
--- /dev/null
+++ b/test/CXX/special/class.copy/p15-0x.cpp
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
+
+namespace PR10622 {
+ struct foo {
+ const int first;
+ foo(const foo&) = default;
+ };
+ void find_or_insert(const foo& __obj) {
+ foo x(__obj);
+ }
+
+ struct bar : foo {
+ bar(const bar&) = default;
+ };
+ void test_bar(const bar &obj) {
+ bar obj2(obj);
+ }
+}
diff --git a/test/CXX/special/class.copy/p33-0x.cpp b/test/CXX/special/class.copy/p33-0x.cpp
index b196865c8225..b66e19ab4c4f 100644
--- a/test/CXX/special/class.copy/p33-0x.cpp
+++ b/test/CXX/special/class.copy/p33-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fsyntax-only -verify %s
class X {
X(const X&);
diff --git a/test/CXX/special/class.ctor/p4-0x.cpp b/test/CXX/special/class.ctor/p4-0x.cpp
index e3508e2e8c47..509beb490302 100644
--- a/test/CXX/special/class.ctor/p4-0x.cpp
+++ b/test/CXX/special/class.ctor/p4-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// A constructor shall not be declared with a ref-qualifier.
struct X {
diff --git a/test/CXX/special/class.ctor/p5-0x.cpp b/test/CXX/special/class.ctor/p5-0x.cpp
index 2123d1662358..de2dea5be16b 100644
--- a/test/CXX/special/class.ctor/p5-0x.cpp
+++ b/test/CXX/special/class.ctor/p5-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
+// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
struct DefaultedDefCtor1 {};
struct DefaultedDefCtor2 { DefaultedDefCtor2() = default; };
@@ -23,10 +23,6 @@ int n;
// default constructor,
union Deleted1a { UserProvidedDefCtor u; }; // expected-note {{deleted here}}
Deleted1a d1a; // expected-error {{deleted constructor}}
-// FIXME: treating this as having a deleted default constructor is probably a
-// bug in the standard.
-union Deleted1b { UserProvidedDefCtor u = UserProvidedDefCtor(); }; // expected-note {{deleted here}}
-Deleted1b d1b; // expected-error {{deleted constructor}}
union NotDeleted1a { DefaultedDefCtor1 nu; };
NotDeleted1a nd1a;
// FIXME: clang implements the pre-FDIS rule, under which DefaultedDefCtor2's
diff --git a/test/CXX/special/class.dtor/p2-0x.cpp b/test/CXX/special/class.dtor/p2-0x.cpp
index 53a2e033efc1..c7b1b586fbcb 100644
--- a/test/CXX/special/class.dtor/p2-0x.cpp
+++ b/test/CXX/special/class.dtor/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// A destructor shall not be declared with a ref-qualifier.
struct X {
diff --git a/test/CXX/special/class.dtor/p3-0x.cpp b/test/CXX/special/class.dtor/p3-0x.cpp
index 6cdd167983bc..44bf5aa01978 100644
--- a/test/CXX/special/class.dtor/p3-0x.cpp
+++ b/test/CXX/special/class.dtor/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s
+// RUN: %clang_cc1 -std=c++11 -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s
struct A {
~A();
diff --git a/test/CXX/special/class.inhctor/elsewhere.cpp b/test/CXX/special/class.inhctor/elsewhere.cpp
index 82944d65dfd1..60cfff80889e 100644
--- a/test/CXX/special/class.inhctor/elsewhere.cpp
+++ b/test/CXX/special/class.inhctor/elsewhere.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Tests related to constructor inheriting, but not specified in [class.inhctor]
diff --git a/test/CXX/special/class.inhctor/p3.cpp b/test/CXX/special/class.inhctor/p3.cpp
index 021f701ab495..989c17c8b462 100644
--- a/test/CXX/special/class.inhctor/p3.cpp
+++ b/test/CXX/special/class.inhctor/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
struct B1 {
B1(int);
@@ -14,7 +14,7 @@ D1 fd1() { return 1; }
struct B2 {
explicit B2(int, int = 0, int = 0);
};
-struct D2 : B2 { // expected-note {{candidate constructor}}
+struct D2 : B2 { // expected-note 2 {{candidate constructor}}
using B2::B2;
};
D2 d2a(1), d2b(1, 1), d2c(1, 1, 1);
@@ -24,7 +24,7 @@ D2 fd2() { return 1; } // expected-error {{no viable conversion}}
struct B3 {
B3(void*); // expected-note {{inherited from here}}
};
-struct D3 : B3 { // expected-note {{candidate constructor}}
+struct D3 : B3 { // expected-note 2 {{candidate constructor}}
using B3::B3; // expected-note {{candidate constructor (inherited)}}
};
D3 fd3() { return 1; } // expected-error {{no viable conversion}}
diff --git a/test/CXX/special/class.inhctor/p7.cpp b/test/CXX/special/class.inhctor/p7.cpp
index 3ad761f08baa..736754d8a3e3 100644
--- a/test/CXX/special/class.inhctor/p7.cpp
+++ b/test/CXX/special/class.inhctor/p7.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Straight from the standard
struct B1 {
diff --git a/test/CXX/special/class.init/class.base.init/p8-0x.cpp b/test/CXX/special/class.init/class.base.init/p8-0x.cpp
index 8512a9f7bb3a..3e26e4992d0d 100644
--- a/test/CXX/special/class.init/class.base.init/p8-0x.cpp
+++ b/test/CXX/special/class.init/class.base.init/p8-0x.cpp
@@ -1,15 +1,19 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
int n;
struct S {
int &a; // expected-note 2{{here}}
int &b = n;
+ union {
+ const int k = 42;
+ };
+
S() {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}}
S(int) : a(n) {} // ok
S(char) : b(n) {} // expected-error {{constructor for 'S' must explicitly initialize the reference member 'a'}}
S(double) : a(n), b(n) {} // ok
-};
+} s(0);
union U {
int a = 0;
@@ -21,3 +25,35 @@ union U {
U(char) : b('y') {} // desired-error {{at most one member of a union may be initialized}}
U(double) : a(1), b('y') {} // desired-error {{at most one member of a union may be initialized}}
};
+
+// PR10954: variant members do not acquire an implicit initializer.
+namespace VariantMembers {
+ struct NoDefaultCtor {
+ NoDefaultCtor(int);
+ };
+ union V {
+ NoDefaultCtor ndc;
+ int n;
+
+ V() {}
+ V(int n) : n(n) {}
+ V(int n, bool) : ndc(n) {}
+ };
+ struct K {
+ union {
+ NoDefaultCtor ndc;
+ int n;
+ };
+ K() {}
+ K(int n) : n(n) {}
+ K(int n, bool) : ndc(n) {}
+ };
+ struct Nested {
+ Nested() {}
+ union {
+ struct {
+ NoDefaultCtor ndc;
+ };
+ };
+ };
+}
diff --git a/test/CXX/special/class.init/class.base.init/p9-0x.cpp b/test/CXX/special/class.init/class.base.init/p9-0x.cpp
index 039b1c271a3d..ca5e8072d82f 100644
--- a/test/CXX/special/class.init/class.base.init/p9-0x.cpp
+++ b/test/CXX/special/class.init/class.base.init/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++0x %s -O1 -emit-llvm -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c++11 %s -O1 -emit-llvm -o - | FileCheck %s
struct S {
int n = 10;
diff --git a/test/CXX/special/class.temporary/p1.cpp b/test/CXX/special/class.temporary/p1.cpp
new file mode 100644
index 000000000000..384b1f89fda8
--- /dev/null
+++ b/test/CXX/special/class.temporary/p1.cpp
@@ -0,0 +1,58 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
+
+namespace test0 {
+ struct A {
+ A() = default;
+ int x;
+ int y;
+
+ A(const A&) = delete; // expected-note {{function has been explicitly marked deleted here}}
+ };
+
+ void foo(...);
+
+ void test() {
+ A a;
+ foo(a); // expected-error {{call to deleted constructor of 'test0::A'}}
+ }
+}
+
+namespace test1 {
+ struct A {
+ A() = default;
+ int x;
+ int y;
+
+ private:
+ A(const A&) = default; // expected-note {{declared private here}}
+ };
+
+ void foo(...);
+
+ void test() {
+ A a;
+ // FIXME: this error about variadics is bogus
+ foo(a); // expected-error {{calling a private constructor of class 'test1::A'}} expected-error {{cannot pass object of non-trivial type 'test1::A' through variadic function}}
+ }
+}
+
+// Don't enforce this in an unevaluated context.
+namespace test2 {
+ struct A {
+ A(const A&) = delete; // expected-note {{marked deleted here}}
+ };
+
+ typedef char one[1];
+ typedef char two[2];
+
+ one &meta(bool);
+ two &meta(...);
+
+ void a(A &a) {
+ char check[sizeof(meta(a)) == 2 ? 1 : -1];
+ }
+
+ void b(A &a) {
+ meta(a); // expected-error {{call to deleted constructor}}
+ }
+}
diff --git a/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp b/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp
index 40b4c23841c8..574cb40c4670 100644
--- a/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp
+++ b/test/CXX/stmt.stmt/stmt.dcl/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// PR10034
struct X {};
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 0c92f62582cf..b157fd4b0f92 100644
--- a/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
+++ b/test/CXX/stmt.stmt/stmt.iter/stmt.ranged/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
namespace std {
template<typename T>
@@ -21,7 +21,7 @@ namespace std {
using namespace inner;
}
-struct A { // expected-note {{candidate constructor}}
+struct A { // expected-note 2 {{candidate constructor}}
A();
int *begin(); // expected-note 3{{selected 'begin' function with iterator type 'int *'}} expected-note {{'begin' declared here}}
int *end();
@@ -100,8 +100,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'}}
- // FIXME: when clang supports constexpr, this should be rejected.
- for (constexpr int a : A()) {} // desired-error {{loop variable 'a' may not be declared 'constexpr'}}
+ for (constexpr int a : A()) {} // expected-error {{loop variable 'a' may not be declared 'constexpr'}}
struct NoBeginADL {
null_t alt_end();
diff --git a/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp b/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
index 794a0502582b..1c13bffa212f 100644
--- a/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
+++ b/test/CXX/temp/temp.arg/temp.arg.template/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template <class T> struct eval; // expected-note 3{{template is declared here}}
diff --git a/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp b/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp
index 6f6286f71078..b03ed46e92f0 100644
--- a/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp
+++ b/test/CXX/temp/temp.arg/temp.arg.type/p2-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
// C++03 imposed restrictions in this paragraph that were lifted with 0x, so we
// just test that the example given now parses cleanly.
diff --git a/test/CXX/temp/temp.decls/p3.cpp b/test/CXX/temp/temp.decls/p3.cpp
index 54800e4061ee..41811ff16531 100644
--- a/test/CXX/temp/temp.decls/p3.cpp
+++ b/test/CXX/temp/temp.decls/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> using A = int;
template<typename T> using A<T*> = char; // expected-error {{partial specialization of alias templates is not permitted}}
diff --git a/test/CXX/temp/temp.decls/temp.alias/p1.cpp b/test/CXX/temp/temp.decls/temp.alias/p1.cpp
index 80079b33a53b..966e3c10e5de 100644
--- a/test/CXX/temp/temp.decls/temp.alias/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.alias/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> using U = T;
diff --git a/test/CXX/temp/temp.decls/temp.alias/p2.cpp b/test/CXX/temp/temp.decls/temp.alias/p2.cpp
index e145727a8dd7..a5b39fe5c51f 100644
--- a/test/CXX/temp/temp.decls/temp.alias/p2.cpp
+++ b/test/CXX/temp/temp.decls/temp.alias/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> using U = T;
diff --git a/test/CXX/temp/temp.decls/temp.alias/p3.cpp b/test/CXX/temp/temp.decls/temp.alias/p3.cpp
index 2e9e55cdcb6b..afd9b4b0de30 100644
--- a/test/CXX/temp/temp.decls/temp.alias/p3.cpp
+++ b/test/CXX/temp/temp.decls/temp.alias/p3.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// The example given in the standard (this is rejected for other reasons anyway).
template<class T> struct A;
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
index 14152cf339a8..aa1e2d443fdd 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p8-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<int ...Values> struct X1;
diff --git a/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp b/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp
index d8e07b83e1be..b754368600aa 100644
--- a/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp
+++ b/test/CXX/temp/temp.decls/temp.class.spec/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// -- The argument list of the specialization shall not be identical
// to the implicit argument list of the primary template.
diff --git a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
index 11ec28918e42..63909fb7cdbd 100644
--- a/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
+++ b/test/CXX/temp/temp.decls/temp.fct/temp.func.order/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// Core DR 532.
namespace PR8130 {
diff --git a/test/CXX/temp/temp.decls/temp.friend/p1.cpp b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
index 578de2952d94..63f569be0861 100644
--- a/test/CXX/temp/temp.decls/temp.friend/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.friend/p1.cpp
@@ -332,3 +332,27 @@ namespace test15 {
template class B<int>; // expected-note {{in instantiation}}
}
+
+namespace PR10913 {
+ template<class T> class X;
+
+ template<class T> void f(X<T> *x) {
+ x->member = 0;
+ }
+
+ template<class U, class T> void f2(X<T> *x) {
+ x->member = 0; // expected-error{{'member' is a protected member of 'PR10913::X<int>'}}
+ }
+
+ template<class T> class X {
+ friend void f<T>(X<T> *x);
+ friend void f2<T>(X<int> *x);
+
+ protected:
+ int member; // expected-note{{declared protected here}}
+ };
+
+ template void f(X<int> *);
+ template void f2<int>(X<int> *);
+ template void f2<float>(X<int> *); // expected-note{{in instantiation of function template specialization 'PR10913::f2<float, int>' requested here}}
+}
diff --git a/test/CXX/temp/temp.decls/temp.mem/p5.cpp b/test/CXX/temp/temp.decls/temp.mem/p5.cpp
index a188f05d535e..8bcd773ee98b 100644
--- a/test/CXX/temp/temp.decls/temp.mem/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.mem/p5.cpp
@@ -63,7 +63,8 @@ struct X0 {
template<typename T> operator const T*() const {
T x = T();
- return x; // expected-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}}
+ return x; // expected-error{{cannot initialize return object of type 'const char *' with an lvalue of type 'char'}} \
+ // expected-error{{cannot initialize return object of type 'const int *' with an lvalue of type 'int'}}
}
};
@@ -72,7 +73,7 @@ template X0::operator const int*(); // expected-note{{'X0::operator const int *<
template X0::operator float*() const; // expected-error{{explicit instantiation of undefined function template}}
void test_X0(X0 x0, const X0 &x0c) {
- x0.operator const int*();
+ x0.operator const int*(); // expected-note{{in instantiation of function template specialization}}
x0.operator float *();
x0c.operator const char*();
}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp
index 383e268054b6..fec8060955e3 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/deduction.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
namespace DeductionForInstantiation {
template<unsigned I, typename ...Types>
diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp
index 83db1719b769..db28eea98a54 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/example-bind.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Example bind implementation from the variadic templates proposal,
// ISO C++ committee document number N2080.
diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp
index b3d010c88d95..e15203abc615 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/example-function.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Example function implementation from the variadic templates proposal,
// ISO C++ committee document number N2080.
diff --git a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp
index 3b4bd7777d55..9de5fa84b48a 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/example-tuple.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Example tuple implementation from the variadic templates proposal,
// ISO C++ committee document number N2080.
diff --git a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
index 7375f98ec9c3..6d9d8c50af68 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/ext-blocks.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fblocks -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fblocks -fsyntax-only -verify %s
// Tests the use of blocks with variadic templates.
template<typename ...Args>
diff --git a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp
index a76ef8067dfd..b5786acf82a2 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/injected-class-name.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Check for declaration matching with out-of-line declarations and
// variadic templates, which involves proper computation of the
diff --git a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
index d80182c1b657..73cbd0749cbd 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/metafunctions.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// This is a collection of various template metafunctions involving
// variadic templates, which are meant to exercise common use cases.
diff --git a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
index cda9ac8b045c..21aa24fb522d 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/multi-level-substitution.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T, T ...Values> struct value_tuple {};
template<typename...> struct tuple { };
@@ -234,3 +234,18 @@ namespace ExpandingFunctionParameters {
x1.f(17, 3.14159);
}
}
+
+namespace PR10230 {
+ template<typename>
+ struct s
+ {
+ template<typename... Args>
+ auto f() -> int(&)[sizeof...(Args)];
+ };
+
+ void main()
+ {
+ int (&ir1)[1] = s<int>().f<int>();
+ int (&ir3)[3] = s<int>().f<int, float, double>();
+ }
+}
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p1.cpp b/test/CXX/temp/temp.decls/temp.variadic/p1.cpp
index 02f4c59b760b..daff9d189690 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p1.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<class ...Types> struct Tuple;
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p2.cpp b/test/CXX/temp/temp.decls/temp.variadic/p2.cpp
index 100ae2c52f9a..ce19582c2282 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p2.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p2.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<class ... Types> void f(Types ... args);
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
index 71839727e0d1..05e492167cbe 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p4.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -fexceptions -fcxx-exceptions -verify %s
template<typename... Types> struct tuple;
template<int I> struct int_c;
@@ -52,6 +52,7 @@ struct HasMixins : public Mixins... {
};
struct A { }; // expected-note{{candidate constructor (the implicit copy constructor) not viable: no known conversion from 'int' to 'const A' for 1st argument}} \
+// expected-note{{candidate constructor (the implicit move constructor) not viable: no known conversion from 'int' to 'A' for 1st argument}} \
// expected-note{{candidate constructor (the implicit default constructor) not viable: requires 0 arguments, but 1 was provided}}
struct B { };
struct C { };
diff --git a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
index 25338e3bae67..0f409e709e98 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/p5.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++0x -fblocks -fms-extensions -fsyntax-only -verify %s
+// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -std=c++11 -fblocks -fms-extensions -fsyntax-only -verify %s
template<typename T, typename U> struct pair;
template<typename ...> struct tuple;
diff --git a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp
index 989ff9f6d9f5..79340c3741a8 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/parameter-matching.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Check for template type parameter pack (mis-)matches with template
// type parameters.
diff --git a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp
index 372317838e74..71bd6aa8eb52 100644
--- a/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp
+++ b/test/CXX/temp/temp.decls/temp.variadic/partial-ordering.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Various tests related to partial ordering of variadic templates.
template<typename ...Types> struct tuple;
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
index 46d70b671f6e..4d29b740d803 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
namespace ParameterPacksWithFunctions {
template<typename ...> struct count;
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
index 1140aaee6c17..de3b44f1b513 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p3-nodeduct.cpp
@@ -29,8 +29,8 @@ struct is_same<T, T> {
int typeof0[is_same<__typeof__(f<int>), void (int)>::value? 1 : -1];
int typeof1[is_same<__typeof__(&f<int>), void (*)(int)>::value? 1 : -1];
-template <typename T> void g(T); // expected-note{{candidate function}}
-template <typename T> void g(T, T); // expected-note{{candidate function}}
+template <typename T> void g(T); // expected-note{{possible target for call}}
+template <typename T> void g(T, T); // expected-note{{possible target for call}}
int typeof2[is_same<__typeof__(g<float>), void (int)>::value? 1 : -1]; // \
- // expected-error{{cannot resolve overloaded function 'g' from context}}
+ // expected-error{{reference to overloaded function could not be resolved; did you mean to call it?}}
diff --git a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
index b38cc2760937..81addfe4bdcd 100644
--- a/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.arg.explicit/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Metafunction to extract the Nth type from a set of types.
template<unsigned N, typename ...Types> struct get_nth_type;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp
index d3af0d4b9132..c14b063ab746 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/cwg1170.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
#if !__has_feature(cxx_access_control_sfinae)
# error No support for access control as part of SFINAE?
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
index 8933b63ee6df..8b192fa547b2 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Metafunction to extract the Nth type from a set of types.
template<unsigned N, typename ...Types> struct get_nth_type;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
index f18a74a1e4ef..e470dd016644 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// If P is an rvalue reference to a cv-unqualified template parameter
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
new file mode 100644
index 000000000000..9236efce2b83
--- /dev/null
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.call/p4.cpp
@@ -0,0 +1,12 @@
+// RUN: %clang_cc1 -fsyntax-only -verify %s
+
+namespace PR8598 {
+ template<class T> struct identity { typedef T type; };
+
+ template<class T, class C>
+ void f(T C::*, typename identity<T>::type*){}
+
+ struct X { void f() {}; };
+
+ void g() { (f)(&X::f, 0); }
+}
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
index 116810082d9f..b96530056b2c 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p12.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Note: Partial ordering of function templates containing template
// parameter packs is independent of the number of deduced arguments
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
index 46ea4db779ce..f204caf57abd 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.partial/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> int &f0(T&);
template<typename T> float &f0(T&&);
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
index 9d342c8f8ed6..8183061a8ab4 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p10-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename T> void f(T&&);
template<> void f(int&) { }
void (*fp)(int&) = &f;
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
index 198f11fe5298..5b031c24ed71 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// If type deduction cannot be done for any P/A pair, or if for any
// pair the deduction leads to more than one possible set of deduced
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
index 247b98113ae5..4e98a6d15e1a 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p21.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Note: Template argument deduction involving parameter packs
// (14.5.3) can deduce zero or more arguments for each parameter pack.
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
index 4326a691cb2e..fcc6cf7ec732 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p22.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// If the original function parameter associated with A is a function
// parameter pack and the function parameter associated with P is not
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
index cf68a01a3593..c819d973a941 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p5-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// FIXME: More bullets to go!
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
index a9173fd6be86..a6b1172afccc 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p8-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// Deductions specific to C++0x.
diff --git a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
index 508722437c39..7774b5c77fa8 100644
--- a/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
+++ b/test/CXX/temp/temp.fct.spec/temp.deduct/temp.deduct.type/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
template<typename ...Types> struct tuple;
template<unsigned> struct unsigned_c;
diff --git a/test/CXX/temp/temp.param/p10-0x.cpp b/test/CXX/temp/temp.param/p10-0x.cpp
index bc7e616fb13d..37bb284a36eb 100644
--- a/test/CXX/temp/temp.param/p10-0x.cpp
+++ b/test/CXX/temp/temp.param/p10-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
template<typename> struct Y1;
template<typename, int> struct Y2;
diff --git a/test/CXX/temp/temp.param/p11-0x.cpp b/test/CXX/temp/temp.param/p11-0x.cpp
index 10a44380c8d1..1971aa10c2c7 100644
--- a/test/CXX/temp/temp.param/p11-0x.cpp
+++ b/test/CXX/temp/temp.param/p11-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// If a template-parameter of a class template or alias template has a default
// template-argument, each subsequent template-parameter shall either have a
diff --git a/test/CXX/temp/temp.param/p15-cxx0x.cpp b/test/CXX/temp/temp.param/p15-cxx0x.cpp
index f4be5b960b6c..5fc57a43f541 100644
--- a/test/CXX/temp/temp.param/p15-cxx0x.cpp
+++ b/test/CXX/temp/temp.param/p15-cxx0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
template<typename T> struct X;
template<int I> struct Y;
diff --git a/test/CXX/temp/temp.param/p15.cpp b/test/CXX/temp/temp.param/p15.cpp
index 13087791a3db..ee572e986b93 100644
--- a/test/CXX/temp/temp.param/p15.cpp
+++ b/test/CXX/temp/temp.param/p15.cpp
@@ -9,4 +9,4 @@ X<X<X<X<int>> // expected-error{{a space is required between consecutive right a
>> *x3; // expected-error{{a space is required between consecutive right angle brackets (use '> >')}}
Y<(1 >> 2)> *y1;
-Y<1 >> 2> *y2; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++0x}}
+Y<1 >> 2> *y2; // expected-warning{{use of right-shift operator ('>>') in template argument will require parentheses in C++11}}
diff --git a/test/CXX/temp/temp.param/p9-0x.cpp b/test/CXX/temp/temp.param/p9-0x.cpp
index 1dc6640fe266..29a7549a8f1a 100644
--- a/test/CXX/temp/temp.param/p9-0x.cpp
+++ b/test/CXX/temp/temp.param/p9-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -fsyntax-only -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s
// A default template-argument may be specified for any kind of
// template-parameter that is not a template parameter pack.
diff --git a/test/CXX/temp/temp.param/p9.cpp b/test/CXX/temp/temp.param/p9.cpp
index 62af522cd2c9..b2318c275e44 100644
--- a/test/CXX/temp/temp.param/p9.cpp
+++ b/test/CXX/temp/temp.param/p9.cpp
@@ -2,9 +2,9 @@
// A default template-argument shall not be specified in a function
// template declaration or a function template definition
-template<typename T = int> // expected-warning{{default template arguments for a function template are a C++0x extension}}
+template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
void foo0(T);
-template<typename T = int> // expected-warning{{default template arguments for a function template are a C++0x extension}}
+template<typename T = int> // expected-warning{{default template arguments for a function template are a C++11 extension}}
void foo1(T) { }
// [...] nor in the template-parameter-list of the definition of a
diff --git a/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp b/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp
index 1d1d350cf337..81b070f040ee 100644
--- a/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp
+++ b/test/CXX/temp/temp.res/temp.dep/temp.dep.type/p1.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// Examples from CWG1056.
namespace Example1 {
diff --git a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
index 4a17ceca7cb6..acfbb46447de 100644
--- a/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.expl.spec/p2-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
// This test creates cases where implicit instantiations of various entities
// would cause a diagnostic, but provides expliict specializations for those
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 a4caceae4954..97e78fd791fa 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p1-0x.cpp
@@ -1,10 +1,15 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
template<typename T>
struct X {
void f() {}
};
-template inline void X<int>::f(); // expected-error{{'inline'}}
+template inline void X<int>::f(); // expected-error{{explicit instantiation cannot be 'inline'}}
-// FIXME: test constexpr
+template<typename T>
+struct Y {
+ constexpr int f() { return 0; }
+};
+
+template constexpr int Y<int>::f(); // expected-error{{explicit instantiation cannot be 'constexpr'}}
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp
index fdb922abcf9b..1028830abe75 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p3-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -std=c++0x -verify %s
+// RUN: %clang_cc1 -std=c++11 -verify %s
// If the name declared in the explicit instantiation is an
// unqualified name, the explicit instantiation shall appear in the
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
index 57b012f9a946..04e7df5741e2 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p9-linkage.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -O1 -emit-llvm -std=c++0x -o - %s | FileCheck %s
+// RUN: %clang_cc1 -O1 -emit-llvm -std=c++11 -o - %s | FileCheck %s
template<typename T>
struct X0 {
diff --git a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
index ad973bb7c589..86490175f0c3 100644
--- a/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
+++ b/test/CXX/temp/temp.spec/temp.explicit/p9.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -std=c++0x -verify %s
+// RUN: %clang_cc1 -fsyntax-only -std=c++11 -verify %s
template<typename T>
struct X0 {
diff --git a/test/CXX/temp/temp.type/p1-0x.cpp b/test/CXX/temp/temp.type/p1-0x.cpp
index c22af22f9865..35d00c2fab20 100644
--- a/test/CXX/temp/temp.type/p1-0x.cpp
+++ b/test/CXX/temp/temp.type/p1-0x.cpp
@@ -1,4 +1,4 @@
-// RUN: %clang_cc1 -fsyntax-only -verify -std=c++0x %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
namespace Old {
template<template<class> class TT> struct X { };