summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/cpp0x
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/auto1.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype-call4.C13
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype9.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/forw_enum9.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C7
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C23
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C2
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C28
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/noexcept30.C12
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/trailing14.C15
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C9
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C22
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C16
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C27
16 files changed, 212 insertions, 7 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C
new file mode 100644
index 00000000000..6bf9b7b1666
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-60.C
@@ -0,0 +1,16 @@
+// PR c++/72764
+// { dg-do compile { target c++11 } }
+
+template < typename > struct A;
+template < typename > struct B {};
+
+template < typename T >
+using C = typename A < T >::template D < T >;
+
+template < typename T > struct A
+{
+ // should be: template < typename > struct D : B < C < T > > {};
+ struct D : B < C < T > > {}; // { dg-error "not a class template" }
+};
+
+A < int >::D a; // { dg-message "required" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/auto1.C b/gcc/testsuite/g++.dg/cpp0x/auto1.C
index b8d39051821..dd8f5fc8cf9 100644
--- a/gcc/testsuite/g++.dg/cpp0x/auto1.C
+++ b/gcc/testsuite/g++.dg/cpp0x/auto1.C
@@ -1,9 +1,14 @@
// { dg-do compile { target c++11 } }
-// { dg-options "-std=c++98 -Wc++11-compat" }
+// { dg-options "-std=c++98 -Wc++11-compat -fdiagnostics-show-caret" }
// Test warning for use of auto in C++98 mode with C++11
// compatibility warnings
void f()
{
- auto int x = 5; // { dg-warning "changes meaning" }
+ auto int x = 5; /* { dg-warning "changes meaning" }
+ { dg-begin-multiline-output "" }
+ auto int x = 5;
+ ^~~~
+ ----
+ { dg-end-multiline-output "" } */
}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C
new file mode 100644
index 00000000000..d504954bc63
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype-call4.C
@@ -0,0 +1,13 @@
+// PR c++/81188
+// { dg-do compile { target c++11 } }
+
+template <class F>
+struct C {
+ F fast(long i) const;
+ auto operator[](long i) const -> decltype(this->fast(i));
+};
+
+template <class F>
+auto C<F>::operator[](long i) const -> decltype(this->fast(i)) {
+ return fast(i);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype9.C b/gcc/testsuite/g++.dg/cpp0x/decltype9.C
index 9db3db039a2..45cd9ed7da3 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype9.C
@@ -1,9 +1,9 @@
// PR c++/34271
// { dg-do compile { target c++11 } }
-template<int> struct A
-{
+template<int> struct A { // { dg-message "defined here" }
static int i;
};
-template<int N> int A<N>::i(decltype (A::i)); // { dg-error "member function|must be an expression" }
+template<int N> int A<N>::i(decltype (A::i)); // { dg-error "no declaration" }
+// { dg-message "no functions" "note" { target *-*-* } .-1 }
diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
index 4f1475acfde..acf16c6c8bd 100644
--- a/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
+++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum9.C
@@ -4,7 +4,7 @@
template<typename T> struct S1
{
enum E1 : int;
- enum class E2 : int;
+ enum class E2 : T;
};
template<typename T> enum S1<T>::E1 : int { e1 };
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C
new file mode 100644
index 00000000000..90a06c610f3
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor28.C
@@ -0,0 +1,7 @@
+// PR c++/81164
+// { dg-do compile { target c++11 } }
+
+struct A {};
+struct B : virtual A {};
+struct C : virtual A {};
+struct D : B,C { using A::A; }; // { dg-error "indirect" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C
new file mode 100644
index 00000000000..8e31f739d74
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor29.C
@@ -0,0 +1,23 @@
+// PR c++/67054
+// { dg-do compile { target c++11 } }
+
+struct A
+{
+ A(int) {}
+};
+
+struct C
+{
+ C(int) {}
+};
+
+struct B : A
+{
+ using A::A;
+ C c = 42;
+};
+
+int main()
+{
+ B b = 24;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C
index 8cbeed66047..c5a00750236 100644
--- a/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C
+++ b/gcc/testsuite/g++.dg/cpp0x/inh-ctor3.C
@@ -8,7 +8,7 @@ struct B2 {
B2(int);
};
struct D1 : B1, B2 {
- using B1::B1; // { dg-error "inherited" }
+ using B1::B1; // { dg-message "declared" }
using B2::B2; // { dg-error "inherited" }
}; // ill-formed: attempts to declare D1(int) twice
struct D2 : B1, B2 {
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C
new file mode 100644
index 00000000000..57111fdef6a
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice17.C
@@ -0,0 +1,12 @@
+// PR c++/71570
+// { dg-do compile { target c++11 } }
+
+void foo (int);
+
+void foo (void)
+{
+ [&foo] // { dg-error "cannot capture" }
+ {
+ foo (0);
+ };
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C b/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C
new file mode 100644
index 00000000000..8e803c82f24
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/missing-initializer_list-include.C
@@ -0,0 +1,28 @@
+/* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+
+/* { dg-options "-fdiagnostics-generate-patch" } */
+
+// { dg-do compile { target c++11 } }
+
+void test (int i)
+{
+ auto a = { &i }; // { dg-error "deducing from brace-enclosed initializer list requires #include <initializer_list>" }
+}
+
+/* Verify the output from -fdiagnostics-generate-patch.
+ We expect the patch to begin with a header, containing this
+ source filename, via an absolute path.
+ Given the path, we can only capture it via regexps. */
+/* { dg-regexp "\\-\\-\\- .*" } */
+/* { dg-regexp "\\+\\+\\+ .*" } */
+/* Use #if 0/#endif rather than comments, to allow the text to contain
+ a comment. */
+#if 0
+{ dg-begin-multiline-output "" }
+@@ -1,3 +1,4 @@
++#include <initializer_list>
+ /* This is padding (to avoid the generated patch containing DejaGnu
+ directives). */
+{ dg-end-multiline-output "" }
+#endif
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept30.C b/gcc/testsuite/g++.dg/cpp0x/noexcept30.C
new file mode 100644
index 00000000000..c51e94e7573
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/noexcept30.C
@@ -0,0 +1,12 @@
+// PR c++/69300
+// { dg-do compile { target c++11 } }
+
+template<typename A>
+struct F {
+ template<typename B>
+ void f() noexcept(&F::template f<B>) {} // { dg-error "exception specification" }
+};
+
+int main () {
+ F<void>().f<int>();
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing14.C b/gcc/testsuite/g++.dg/cpp0x/trailing14.C
new file mode 100644
index 00000000000..2544d0bab5e
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/trailing14.C
@@ -0,0 +1,15 @@
+// PR c++/65775
+// { dg-do compile { target c++11 } }
+// { dg-options "-Wignored-qualifiers" }
+
+using Qi = int const volatile;
+Qi q1(); // { dg-warning "1: type qualifiers ignored" }
+auto q2() -> Qi; // { dg-warning "1: type qualifiers ignored" }
+
+using Fi = int();
+Fi f1(); // { dg-error "1: 'f1' declared as function returning a function" }
+auto f2() -> Fi; // { dg-error "1: 'f2' declared as function returning a function" }
+
+using Ai = int[5];
+Ai a1(); // { dg-error "1: 'a1' declared as function returning an array" }
+auto a2() -> Ai; // { dg-error "1: 'a2' declared as function returning an array" }
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C
new file mode 100644
index 00000000000..4a02ab22990
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-mem_fn2.C
@@ -0,0 +1,9 @@
+// { dg-do compile { target c++11 } }
+
+template <class A0, class... As> struct tuple
+{
+ tuple<As...> tail;
+ template <int Offset, class... More> int apply(const More&... more) {
+ return tail.apply<1>(more...); // { dg-error "" } needs .template
+ }
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C
new file mode 100644
index 00000000000..6f8df3e1aaf
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-partial1.C
@@ -0,0 +1,22 @@
+// PR c++/72801
+// { dg-do compile { target c++11 } }
+
+template < typename, typename > struct A {};
+
+template < typename ... T > struct B
+{
+ template < typename > struct C
+ {
+ static const int a = 0;
+ };
+
+ template < typename R, typename ... S >
+ struct C < R (A < T, S > ...) >
+ {
+ static const int a = 1;
+ };
+};
+
+#define SA(X) static_assert ((X), #X)
+SA(B <>::C<int()>::a == 1);
+
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C
new file mode 100644
index 00000000000..0dbe904601d
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp7.C
@@ -0,0 +1,16 @@
+// PR c++/81215
+// { dg-do compile { target c++11 } }
+
+template<typename U> struct X { };
+template<typename T, typename U = void> struct set { };
+
+template <typename V, template <typename...> class C>
+void bar (const X<C<V>>&)
+{
+}
+
+void
+foo (X<set<int>>& x)
+{
+ bar (x);
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C
new file mode 100644
index 00000000000..f3e576ae988
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/variadic-ttp8.C
@@ -0,0 +1,27 @@
+// PR c++/69111
+// { dg-do compile { target c++11 } }
+
+template <template <typename> class ...>
+struct template_list {};
+
+template <typename T>
+struct A
+{};
+
+template <typename>
+struct B
+{
+ template <typename T>
+ using type = A<T>;
+};
+
+template <typename ... Types>
+struct C
+{
+ using type = template_list<B<Types>::template type...>;
+};
+
+int main()
+{
+ return 0;
+}