summaryrefslogtreecommitdiffstats
path: root/test/CXX/basic
diff options
context:
space:
mode:
authordim <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
committerdim <dim@FreeBSD.org>2013-06-10 20:45:12 +0000
commitea266cad53e3d49771fa38103913d3ec7a166694 (patch)
tree8f7776b7310bebaf415ac5b69e46e9f928c37144 /test/CXX/basic
parentc72c57c9e9b69944e3e009cd5e209634839581d3 (diff)
downloadFreeBSD-src-ea266cad53e3d49771fa38103913d3ec7a166694.zip
FreeBSD-src-ea266cad53e3d49771fa38103913d3ec7a166694.tar.gz
Vendor import of clang tags/RELEASE_33/final r183502 (effectively, 3.3
release): http://llvm.org/svn/llvm-project/cfe/tags/RELEASE_33/final@183502
Diffstat (limited to 'test/CXX/basic')
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp23
-rw-r--r--test/CXX/basic/basic.types/p10.cpp24
2 files changed, 40 insertions, 7 deletions
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
index 7da3087..6fba972 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.unqual/p14.cpp
@@ -47,3 +47,26 @@ class Other {
void Other::foo(YFloat a, YFloat b) {
YFloat c = a - b;
}
+
+// <rdar://problem/13540899>
+namespace Other {
+ void other_foo();
+}
+
+namespace M2 {
+ using namespace Other;
+
+ extern "C" {
+ namespace MInner {
+ extern "C" {
+ class Bar {
+ void bar();
+ };
+ }
+ }
+ }
+}
+
+void M2::MInner::Bar::bar() {
+ other_foo();
+}
diff --git a/test/CXX/basic/basic.types/p10.cpp b/test/CXX/basic/basic.types/p10.cpp
index 6401c29..9d99a77 100644
--- a/test/CXX/basic/basic.types/p10.cpp
+++ b/test/CXX/basic/basic.types/p10.cpp
@@ -1,9 +1,16 @@
// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++1y %s -DCXX1Y
struct NonLiteral { NonLiteral(); };
// A type is a literal type if it is:
+// [C++1y] - void
+constexpr void f() {}
+#ifndef CXX1Y
+// expected-error@-2 {{'void' is not a literal type}}
+#endif
+
// - a scalar type
constexpr int f1(double) { return 0; }
@@ -11,7 +18,6 @@ constexpr int f1(double) { return 0; }
struct S { S(); };
constexpr int f2(S &) { return 0; }
-// FIXME: I'm not entirely sure whether the following is legal or not...
struct BeingDefined;
extern BeingDefined beingdefined;
struct BeingDefined {
@@ -32,13 +38,13 @@ constexpr ClassTemp<int> classtemplate2[] = {};
// - it has a trivial destructor
struct UserProvDtor {
- constexpr int f(); // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}}
+ constexpr int f() const; // expected-error {{non-literal type 'UserProvDtor' cannot have constexpr members}}
~UserProvDtor(); // expected-note {{has a user-provided destructor}}
};
struct NonTrivDtor {
constexpr NonTrivDtor();
- constexpr int f(); // expected-error {{non-literal type 'NonTrivDtor' cannot have constexpr members}}
+ constexpr int f() const; // expected-error {{non-literal type 'NonTrivDtor' cannot have constexpr members}}
virtual ~NonTrivDtor() = default; // expected-note {{has a non-trivial destructor}} expected-note {{because it is virtual}}
};
struct NonTrivDtorBase {
@@ -71,11 +77,11 @@ struct CtorTemplate {
};
struct CopyCtorOnly { // expected-note {{'CopyCtorOnly' is not literal because it is not an aggregate and has no constexpr constructors other than copy or move constructors}}
constexpr CopyCtorOnly(CopyCtorOnly&);
- constexpr int f(); // expected-error {{non-literal type 'CopyCtorOnly' cannot have constexpr members}}
+ constexpr int f() const; // 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&&);
- constexpr int f(); // expected-error {{non-literal type 'MoveCtorOnly' cannot have constexpr members}}
+ constexpr int f() const; // expected-error {{non-literal type 'MoveCtorOnly' cannot have constexpr members}}
};
template<typename T>
struct CtorArg {
@@ -104,7 +110,7 @@ constexpr int f(NonLitMember) {} // expected-error {{1st parameter type 'NonLitM
struct NonLitBase :
S { // expected-note {{base class 'S' of non-literal type}}
constexpr NonLitBase();
- constexpr int f() { return 0; } // expected-error {{non-literal type 'NonLitBase' cannot have constexpr members}}
+ constexpr int f() const { return 0; } // expected-error {{non-literal type 'NonLitBase' cannot have constexpr members}}
};
struct LitMemBase : Agg {
Agg agg;
@@ -117,7 +123,7 @@ struct MemberType {
constexpr int f(MemberType<int>) { return 0; }
constexpr int f(MemberType<NonLiteral>) { return 0; } // expected-error {{not a literal type}}
-// - an array of literal type
+// - an array of literal type [C++1y] other than an array of runtime bound
struct ArrGood {
Agg agg[24];
double d[12];
@@ -130,3 +136,7 @@ struct ArrBad {
S s[3]; // expected-note {{data member 's' of non-literal type 'S [3]'}}
};
constexpr int f(ArrBad) { return 0; } // expected-error {{1st parameter type 'ArrBad' is not a literal type}}
+
+constexpr int arb(int n) {
+ int a[n]; // expected-error {{variable of non-literal type 'int [n]' cannot be defined in a constexpr function}}
+}
OpenPOWER on IntegriCloud