aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp0x
diff options
context:
space:
mode:
Diffstat (limited to 'gcc-4.9/gcc/testsuite/g++.dg/cpp0x')
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C43
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C13
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C19
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C7
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C31
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C4
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C11
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C12
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C51
-rw-r--r--gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C14
10 files changed, 205 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C
new file mode 100644
index 000000000..bd20b54f1
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/alias-decl-44.C
@@ -0,0 +1,43 @@
+// PR c++/63849
+// { dg-do compile { target c++11 } }
+
+template <class _T, class...>
+using First = _T; // we should not use this
+ // alias with only
+ // one pack parameter (?)
+
+template <template <class...> class _Successor,
+ int,
+ class... _Xs>
+struct Overlay
+{
+ using O = _Successor<_Xs...>;
+};
+
+template <class... _Pack>
+struct List
+{
+ template <int _s>
+ using O = typename Overlay<List, _s, _Pack...>::O;
+
+ template <template <class...> class _S>
+ using Pass = _S<_Pack...>;
+
+ template <int _i>
+ using At = typename O<_i>
+ ::template Pass<First>;
+};
+
+template <int _i>
+using At = typename List<int, char>
+::template At<_i>;
+
+template <int _i>
+void func_crash(At<_i>&) {}
+
+int main(int argc, char *argv[])
+{
+ char ccc;
+ int iii;
+ func_crash<0>(iii);
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C
new file mode 100644
index 000000000..2553cae34
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63241.C
@@ -0,0 +1,13 @@
+// PR c++/63241
+// { dg-do compile { target c++11 } }
+
+struct A {
+ constexpr A(int){}
+};
+
+int main() {
+ int i = 1;
+ A array[2][2] =
+ {{{0}, {i}},
+ {{0}, {0}}};
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C
new file mode 100644
index 000000000..aa0ce5e7c
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-63265.C
@@ -0,0 +1,19 @@
+// PR c++/63265
+// { dg-do compile { target c++11 } }
+
+#define LSHIFT (sizeof(unsigned int) * __CHAR_BIT__)
+
+template <int lshift>
+struct SpuriouslyWarns1 {
+ static constexpr unsigned int v = lshift < LSHIFT ? 1U << lshift : 0;
+};
+
+static_assert(SpuriouslyWarns1<LSHIFT>::v == 0, "Impossible occurred");
+
+template <int lshift>
+struct SpuriouslyWarns2 {
+ static constexpr bool okay = lshift < LSHIFT;
+ static constexpr unsigned int v = okay ? 1U << lshift : 0;
+};
+
+static_assert(SpuriouslyWarns2<LSHIFT>::v == 0, "Impossible occurred");
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C
new file mode 100644
index 000000000..3d859a852
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/constexpr-initlist8.C
@@ -0,0 +1,7 @@
+// PR c++/63415
+// { dg-do compile { target c++11 } }
+
+template <typename T>
+struct A {
+ static constexpr int value = int(T{});
+};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C
new file mode 100644
index 000000000..af97be7c3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/deleted9.C
@@ -0,0 +1,31 @@
+// PR c++/64352
+// { dg-do compile { target c++11 } }
+
+template<bool B> struct bool_type
+{ static constexpr bool value = B; };
+
+using true_type = bool_type<true>;
+using false_type = bool_type<false>;
+
+template<typename T> T&& declval();
+
+template<typename...> struct void_ { using type = void; };
+template<typename... I> using void_t = typename void_<I...>::type;
+
+template<typename _Tp, typename = void>
+struct _Has_addressof_free: false_type { };
+
+template<typename _Tp>
+struct _Has_addressof_free
+<_Tp, void_t<decltype( operator&(declval<const _Tp&>()) )>>
+: true_type { };
+
+struct foo {};
+void operator&(foo) = delete;
+
+int main()
+{
+ static_assert( !_Has_addressof_free<int>::value, "" );
+ // error: use of deleted function 'void operator&(foo)'
+ static_assert( !_Has_addressof_free<foo>::value, "" );
+}
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C
new file mode 100644
index 000000000..e221664e3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/initlist89.C
@@ -0,0 +1,4 @@
+// PR c++/64029
+// { dg-do compile { target c++11 } }
+
+const int (&in)[]{1,2,3,4,5};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C
new file mode 100644
index 000000000..b73ef753e
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-template14.C
@@ -0,0 +1,11 @@
+// PR c++/62219
+// { dg-do compile { target c++11 } }
+
+template< class = void >
+struct S
+{
+ friend void foo( S )
+ {
+ [](){};
+ }
+};
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
new file mode 100644
index 000000000..1d7650bb6
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/ref-qual16.C
@@ -0,0 +1,12 @@
+// PR c++/64297
+// { dg-do compile { target c++11 } }
+
+struct A {
+ typedef int X;
+ template <int> X m_fn1() const;
+};
+template <typename> struct is_function {};
+is_function<int() const &> i;
+struct D {
+ template <typename Y, typename = is_function<Y>> D(Y);
+} b(&A::m_fn1<0>);
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C
new file mode 100644
index 000000000..ac6eaf6a3
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic161.C
@@ -0,0 +1,51 @@
+// PR c++/63139
+// { dg-do compile { target c++11 } }
+
+template<typename ...T>
+struct type_list {};
+
+template<typename ...T>
+struct make_type_list
+{
+ using type = type_list<T...>;
+};
+
+// The bug disappears if you use make_type_list directly.
+template<typename ...T>
+using make_type_list_t = typename make_type_list<T...>::type;
+
+
+struct ContainerEndA {};
+
+template<typename ...Ts>
+struct ContainerA
+{
+ using type = make_type_list_t<Ts..., ContainerEndA>;
+};
+
+
+struct ContainerEndB {};
+
+template<typename ...Ts>
+struct ContainerB
+{
+ using type = make_type_list_t<Ts..., ContainerEndB>;
+};
+
+template<typename T, typename U>
+struct is_same
+{
+ static const bool value = false;
+};
+
+template<typename T>
+struct is_same<T, T>
+{
+ static const bool value = true;
+};
+
+#define SA(X) static_assert((X), #X)
+
+SA((is_same<ContainerB<>::type, type_list<ContainerEndB>>::value));
+SA((!is_same<ContainerA<>::type, type_list<ContainerEndB>>::value));
+SA((!is_same<ContainerA<>::type, ContainerB<>::type>::value));
diff --git a/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C
new file mode 100644
index 000000000..9e5386deb
--- /dev/null
+++ b/gcc-4.9/gcc/testsuite/g++.dg/cpp0x/variadic162.C
@@ -0,0 +1,14 @@
+// PR c++/63405
+// { dg-do compile { target c++11 } }
+
+template <typename _Tp> _Tp forward(_Tp);
+template <typename Args> struct Format { Format(int, Args); };
+template <typename... Args> auto format(Args &&... args) -> Format<Args...> {
+ return {0, args...};
+}
+
+template <typename... Args> void msg(Args... args) {
+ format(forward(args)...);
+}
+
+void some_function() { msg('x'); }