aboutsummaryrefslogtreecommitdiff
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-23.C17
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-ref4.C18
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/defaulted38.C14
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C10
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr54323.C37
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/stddef.C6
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/stdint.C135
7 files changed, 237 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-23.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-23.C
new file mode 100644
index 000000000..0e4ba45aa
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-23.C
@@ -0,0 +1,17 @@
+// PR c++/52233
+// { dg-do compile { target c++11 } }
+
+template <typename t>
+struct foo
+{
+ template <template <typename...> class... xs>
+ using type = int;
+};
+
+template <typename t, template <typename...> class... xs>
+struct bar
+{
+ using type = typename foo<t>::template type<xs...>;
+};
+
+bar<int, foo> x;
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ref4.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref4.C
new file mode 100644
index 000000000..6ae355a27
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ref4.C
@@ -0,0 +1,18 @@
+// PR c++/54777
+// { dg-options -std=c++0x }
+
+struct S
+{
+ int s[1];
+ constexpr const int &foo (unsigned i) { return (i < 1 ? 0 : throw 1), s[i]; }
+ constexpr const int &bar (unsigned i) { return i < 1 ? s[i] : (throw 0, s[i]); }
+};
+
+int
+main ()
+{
+ constexpr S a {};
+ constexpr int i = a.foo (0);
+ constexpr int j = a.bar (0);
+ static_assert (i == j, "Ouch");
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/defaulted38.C b/gcc/testsuite/g++.dg/cpp0x/defaulted38.C
new file mode 100644
index 000000000..39424f641
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/defaulted38.C
@@ -0,0 +1,14 @@
+// PR c++/50893
+// { dg-do compile { target c++11 } }
+
+class Base
+{
+ public:
+ virtual ~Base() = default;
+};
+
+class Derived : public Base
+{
+ public:
+ virtual ~Derived() = default;
+};
diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C
new file mode 100644
index 000000000..00078d53b
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice8.C
@@ -0,0 +1,10 @@
+// PR c++/51422
+// { dg-do compile { target c++11 } }
+
+template<typename> struct A {};
+
+void foo()
+{
+ [i] { A<decltype(i)>(); }; // { dg-error "not declared|invalid" }
+ [i] { A<decltype(i)>(); }; // { dg-error "invalid" }
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr54323.C b/gcc/testsuite/g++.dg/cpp0x/pr54323.C
new file mode 100644
index 000000000..71b6c7192
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/pr54323.C
@@ -0,0 +1,37 @@
+// PR c++/54323
+// { dg-do compile { target c++11 } }
+
+template<bool, typename T = void>
+struct enable_if { };
+
+template<typename T>
+struct enable_if<true, T>
+{ typedef T type; };
+
+template<template<typename> class CRTP, typename T>
+class Base
+{
+public:
+ template<template<typename> class CRTP0, typename T0, class>
+ friend int func(const Base<CRTP0, T0>& rhs);
+
+protected:
+ int n;
+};
+
+template<template<typename> class CRTP0, typename T0,
+ class = typename enable_if<true>::type>
+int func(const Base<CRTP0, T0>& rhs)
+{
+ return rhs.n;
+}
+
+template<typename T>
+class Derived : public Base<Derived, T> {};
+
+int main()
+{
+ Derived<int> x;
+ func(x);
+ return 0;
+}
diff --git a/gcc/testsuite/g++.dg/cpp0x/stddef.C b/gcc/testsuite/g++.dg/cpp0x/stddef.C
new file mode 100644
index 000000000..dad9200cc
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/stddef.C
@@ -0,0 +1,6 @@
+// PR c++/54249
+// { dg-do compile { target c++11 } }
+
+#include <stddef.h>
+
+::nullptr_t n;
diff --git a/gcc/testsuite/g++.dg/cpp0x/stdint.C b/gcc/testsuite/g++.dg/cpp0x/stdint.C
new file mode 100644
index 000000000..434d45824
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/stdint.C
@@ -0,0 +1,135 @@
+// PR c++/52764
+// { dg-require-effective-target stdint_types }
+// { dg-do compile { target c++11 } }
+
+#include <stdint.h>
+
+#ifdef __INT8_TYPE__
+# if (!defined INT8_MAX \
+ || !defined INT8_MIN)
+# error
+# endif
+#endif
+#ifdef __UINT8_TYPE__
+# if !defined UINT8_MAX
+# error
+# endif
+#endif
+#ifdef __INT16_TYPE__
+# if (!defined INT16_MAX \
+ || !defined INT16_MIN)
+# error
+# endif
+#endif
+#ifdef __UINT16_TYPE__
+# if !defined UINT16_MAX
+# error
+# endif
+#endif
+#ifdef __INT32_TYPE__
+# if (!defined INT32_MAX \
+ || !defined INT32_MIN)
+# error
+# endif
+#endif
+#ifdef __UINT32_TYPE__
+# if !defined UINT32_MAX
+# error
+# endif
+#endif
+#ifdef __INT64_TYPE__
+# if (!defined INT64_MAX \
+ || !defined INT64_MIN)
+# error
+# endif
+#endif
+#ifdef __UINT64_TYPE__
+# if !defined UINT64_MAX
+# error
+# endif
+#endif
+
+#if (!defined INT_LEAST8_MAX \
+ || !defined INT_LEAST8_MIN \
+ || !defined UINT_LEAST8_MAX \
+ || !defined INT_LEAST16_MAX \
+ || !defined INT_LEAST16_MIN \
+ || !defined UINT_LEAST16_MAX \
+ || !defined INT_LEAST32_MAX \
+ || !defined INT_LEAST32_MIN \
+ || !defined UINT_LEAST32_MAX \
+ || !defined INT_LEAST64_MAX \
+ || !defined INT_LEAST64_MIN \
+ || !defined UINT_LEAST64_MAX)
+#error
+#endif
+
+#if (!defined INT_FAST8_MAX \
+ || !defined INT_FAST8_MIN \
+ || !defined UINT_FAST8_MAX \
+ || !defined INT_FAST16_MAX \
+ || !defined INT_FAST16_MIN \
+ || !defined UINT_FAST16_MAX \
+ || !defined INT_FAST32_MAX \
+ || !defined INT_FAST32_MIN \
+ || !defined UINT_FAST32_MAX \
+ || !defined INT_FAST64_MAX \
+ || !defined INT_FAST64_MIN \
+ || !defined UINT_FAST64_MAX)
+#error
+#endif
+
+#ifdef __INTPTR_TYPE__
+# if (!defined INTPTR_MAX \
+ || !defined INTPTR_MIN)
+# error
+# endif
+#endif
+#ifdef __UINTPTR_TYPE__
+# if !defined UINTPTR_MAX
+# error
+# endif
+#endif
+
+#if (!defined INTMAX_MAX \
+ || !defined INTMAX_MIN \
+ || !defined UINTMAX_MAX)
+#error
+#endif
+
+#if (!defined PTRDIFF_MAX \
+ || !defined PTRDIFF_MIN)
+#error
+#endif
+
+#if (!defined SIG_ATOMIC_MAX \
+ || !defined SIG_ATOMIC_MIN)
+#error
+#endif
+
+#if !defined SIZE_MAX
+#error
+#endif
+
+#if (!defined WCHAR_MAX \
+ || !defined WCHAR_MIN)
+#error
+#endif
+
+#if (!defined WINT_MAX \
+ || !defined WINT_MIN)
+#error
+#endif
+
+#if (!defined INT8_C \
+ || !defined INT16_C \
+ || !defined INT32_C \
+ || !defined INT64_C \
+ || !defined UINT8_C \
+ || !defined UINT16_C \
+ || !defined UINT32_C \
+ || !defined UINT64_C \
+ || !defined INTMAX_C \
+ || !defined UINTMAX_C)
+#error
+#endif