summaryrefslogtreecommitdiff
path: root/test/CXX/basic
diff options
context:
space:
mode:
Diffstat (limited to 'test/CXX/basic')
-rw-r--r--test/CXX/basic/basic.def/p2.cpp8
-rw-r--r--test/CXX/basic/basic.def/p4.cpp6
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp17
-rw-r--r--test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp9
-rw-r--r--test/CXX/basic/basic.types/p10.cpp42
5 files changed, 75 insertions, 7 deletions
diff --git a/test/CXX/basic/basic.def/p2.cpp b/test/CXX/basic/basic.def/p2.cpp
new file mode 100644
index 000000000000..598a79a8a3d7
--- /dev/null
+++ b/test/CXX/basic/basic.def/p2.cpp
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -std=c++1z -verify %s -Wdeprecated
+
+namespace {
+ struct A {
+ static constexpr int n = 0;
+ };
+ const int A::n; // expected-warning {{deprecated}}
+}
diff --git a/test/CXX/basic/basic.def/p4.cpp b/test/CXX/basic/basic.def/p4.cpp
new file mode 100644
index 000000000000..c3919156bbbb
--- /dev/null
+++ b/test/CXX/basic/basic.def/p4.cpp
@@ -0,0 +1,6 @@
+// RUN: %clang_cc1 -std=c++1z -verify %s
+
+inline int f(); // expected-warning {{inline function 'f' is not defined}}
+extern inline int n; // expected-error {{inline variable 'n' is not defined}}
+
+int use = f() + n; // expected-note 2{{used here}}
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 c20728332704..bb6bb73ec702 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.classref/p1.cpp
@@ -1,4 +1,6 @@
// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++98 %s
+// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-show-option -verify -std=c++11 %s
// C++98 [basic.lookup.classref]p1:
// In a class member access expression (5.2.5), if the . or -> token is
@@ -21,10 +23,16 @@
// From PR 7247
template<typename T>
-struct set{}; // expected-note{{lookup from the current scope refers here}}
+struct set{};
+#if __cplusplus <= 199711L
+// expected-note@-2 {{lookup from the current scope refers here}}
+#endif
struct Value {
template<typename T>
- void set(T value) {} // expected-note{{lookup in the object type 'Value' refers here}}
+ void set(T value) {}
+#if __cplusplus <= 199711L
+ // expected-note@-2 {{lookup in the object type 'Value' refers here}}
+#endif
void resolves_to_same() {
Value v;
@@ -36,7 +44,10 @@ void resolves_to_different() {
Value v;
// The fact that the next line is a warning rather than an error is an
// extension.
- v.set<double>(3.2); // expected-warning{{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}}
+ v.set<double>(3.2);
+#if __cplusplus <= 199711L
+ // expected-warning@-2 {{lookup of 'set' in member access expression is ambiguous; using member of 'Value'}}
+#endif
}
{
int set; // Non-template.
diff --git a/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp b/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
index d1562d4cd18b..f32b23976547 100644
--- a/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
+++ b/test/CXX/basic/basic.lookup/basic.lookup.qual/class.qual/p2.cpp
@@ -53,16 +53,17 @@ namespace InhCtor {
int n = b.T(); // expected-error {{'T' is a protected member of 'InhCtor::A'}}
// expected-note@-15 {{declared protected here}}
+ // FIXME: EDG and GCC reject this too, but it's not clear why it would be
+ // ill-formed.
template<typename T>
struct S : T {
- struct U : S {
+ struct U : S { // expected-note 6{{candidate}}
using S::S;
};
using T::T;
};
-
- S<A>::U ua(0);
- S<B>::U ub(0);
+ S<A>::U ua(0); // expected-error {{no match}}
+ S<B>::U ub(0); // expected-error {{no match}}
template<typename T>
struct X : T {
diff --git a/test/CXX/basic/basic.types/p10.cpp b/test/CXX/basic/basic.types/p10.cpp
index 19258f80f517..31ef6b62cead 100644
--- a/test/CXX/basic/basic.types/p10.cpp
+++ b/test/CXX/basic/basic.types/p10.cpp
@@ -141,3 +141,45 @@ constexpr int arb(int n) {
}
constexpr long Overflow[ // expected-error {{constexpr variable cannot have non-literal type 'long const[(1 << 30) << 2]'}}
(1 << 30) << 2]{}; // expected-warning {{requires 34 bits to represent}}
+
+namespace inherited_ctor {
+ struct A { constexpr A(int); };
+ struct B : A {
+ B();
+ using A::A;
+ };
+ constexpr int f(B) { return 0; } // ok
+
+ struct C { constexpr C(int); };
+ struct D : C { // expected-note {{because}}
+ D(int);
+ using C::C;
+ };
+ constexpr int f(D) { return 0; } // expected-error {{not a literal type}}
+
+ // This one is a bit odd: F inherits E's default constructor, which is
+ // constexpr. Because F has a constructor of its own, it doesn't declare a
+ // default constructor hiding E's one.
+ struct E {};
+ struct F : E {
+ F(int);
+ using E::E;
+ };
+ constexpr int f(F) { return 0; }
+
+ // FIXME: Is this really the right behavior? We presumably should be checking
+ // whether the inherited constructor would be a copy or move constructor for
+ // the derived class, not for the base class.
+ struct G { constexpr G(const G&); };
+ struct H : G { // expected-note {{because}}
+ using G::G;
+ };
+ constexpr int f(H) { return 0; } // expected-error {{not a literal type}}
+
+ struct J;
+ struct I { constexpr I(const J&); };
+ struct J : I {
+ using I::I;
+ };
+ constexpr int f(J) { return 0; }
+}