diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-07-16 11:40:25 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2015-07-16 11:40:25 +0000 |
commit | 8cd167a5ad8baf4988e07fcbc9c9cc338c02d3d1 (patch) | |
tree | 74fd60c507288ef44ed7f786fafeecbb5df0e160 /gcc/testsuite/g++.dg/cpp1y | |
parent | f80b5ea1605c9f9408c5aa386ba71c16d918ebbf (diff) | |
download | gcc-tarball-8cd167a5ad8baf4988e07fcbc9c9cc338c02d3d1.tar.gz |
gcc-5.2.0gcc-5.2.0
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp1y')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/auto-fn26.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/constexpr-empty1.C | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice2.C | 123 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr3.C | 43 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ24.C | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ25.C | 8 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ26.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ27.C | 9 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ29.C | 13 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ30.C | 19 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp1y/var-templ31.C | 8 |
11 files changed, 259 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp1y/auto-fn26.C b/gcc/testsuite/g++.dg/cpp1y/auto-fn26.C new file mode 100644 index 0000000000..17f232fde9 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/auto-fn26.C @@ -0,0 +1,6 @@ +// PR c++/59766 +// { dg-do compile { target c++14 } } + +struct T { + friend auto f() { } +}; diff --git a/gcc/testsuite/g++.dg/cpp1y/constexpr-empty1.C b/gcc/testsuite/g++.dg/cpp1y/constexpr-empty1.C new file mode 100644 index 0000000000..5be44eabdd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/constexpr-empty1.C @@ -0,0 +1,6 @@ +// PR c++/65973 +// { dg-do compile { target c++14 } } + +class foo { + constexpr foo() noexcept { __func__; }; +}; diff --git a/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice2.C b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice2.C new file mode 100644 index 0000000000..57e0ad2b28 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/lambda-generic-ice2.C @@ -0,0 +1,123 @@ +// PR c++/66387 +// { dg-do compile { target c++14 } } + +namespace boost { +namespace hana { +namespace detail { +namespace std { +using size_t = decltype(0); +} +} +namespace ic_detail { +template <typename T, T> struct _with_index { + template <typename F> constexpr void operator()(F &&) const; +}; +template <typename T, T v> struct _times { _with_index<T, v> with_index; }; +} +template <typename T, T v> struct _integral_constant { + using value_type = T; + operator value_type() const; + ic_detail::_times<T, v> times; +}; +template <detail::std::size_t i> +constexpr _integral_constant<detail::std::size_t, i> size_t{}; +template <typename, typename = void> struct datatype; +} +} +namespace std { +typedef int size_t; +inline namespace __cxx11 {} +} +namespace boost { +namespace hana { +template <bool> struct when; +template <typename, typename, typename> struct to_impl; +template <typename T, typename> struct datatype : datatype<T, when<true>> {}; +template <typename T, bool condition> struct datatype<T, when<condition>> { + using type = typename T::hana::datatype; +}; +template <typename> struct _models; +template <typename To, typename From> + struct to_impl < To, + From, when < _models<From> { +} >> ; +namespace detail { +namespace std { +template <typename T, T> struct integer_sequence; +template <size_t... n> using index_sequence = integer_sequence<size_t, n...>; +namespace int_seq_detail { +template <size_t> struct make_index_sequence { + using type = index_sequence<0>; +}; +template <typename, typename> struct cast_to; +template <typename T, typename U, U... u> +struct cast_to<T, integer_sequence<U, u...>> { + using type = integer_sequence<T, u...>; +}; +} +template <typename T, T> +using make_integer_sequence = typename int_seq_detail::cast_to< + T, int_seq_detail::make_index_sequence<1>::type>::type; +} +} +namespace ic_detail { +template <typename T, T N, typename = detail::std::make_integer_sequence<T, N>> +struct go; +template <typename T, T N, T... i> +struct go<T, N, detail::std::integer_sequence<T, i...>> { + using swallow = T; + template <typename F> static void with_index(F f) { + swallow{(f(_integral_constant<T, i>{}), 0)...}; + } +}; +template <typename T, T v> +template <typename F> +constexpr void _with_index<T, v>::operator()(F &&f) const { + go<T, 0>::with_index(f); +} +} +} +} +namespace std { +template <typename> class allocator; +template <class> struct char_traits; +template <typename _CharT, typename = char_traits<_CharT>> class basic_ostream; +namespace __cxx11 { +template <typename _CharT, typename = char_traits<_CharT>, + typename = allocator<_CharT>> +class basic_stringstream; +} +typedef basic_ostream<char> ostream; +typedef basic_stringstream<char> stringstream; +template <typename, typename> class basic_ostream {}; +template <typename _CharT, typename> +class basic_iostream : public basic_ostream<_CharT> {}; +namespace __cxx11 { +template <typename _CharT, typename _Traits, typename> +class basic_stringstream : public basic_iostream<_CharT, _Traits> {}; +} +} +namespace hana = boost::hana; +template <typename> struct print_impl; +template <typename X> void print(std::ostream os, X x) { + using Tag = typename hana::datatype<X>::type; + print_impl<Tag>::apply(os, x); +} +struct Vector; +template <typename, typename> struct vector2 { + struct hana { + using datatype = Vector; + }; + static constexpr std::size_t size = 0; +}; +template <> struct print_impl<Vector> { + template <typename vectorN> static void apply(std::ostream, vectorN) { + constexpr auto N = hana::size_t<vectorN::size>; + N.times.with_index([&](auto) { N - hana::size_t<1>; }); + } +}; +int main() { + std::stringstream ss; + vector2<int, char> v2; + print(ss, v2); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr3.C b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr3.C new file mode 100644 index 0000000000..185ea10d1b --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/nsdmi-aggr3.C @@ -0,0 +1,43 @@ +// PR c++/66383 +// { dg-do compile { target c++11 } } + +namespace N1 { + struct B; + + struct A + { + B* b; + A(B* b); + }; + + struct B + { + A a{ this }; + }; + + A::A(B* b): b{ b } {} + + void foo() + { + auto b = B{}; + } +} + +namespace N2 { + struct B; + + struct A + { + B* b; + }; + + struct B + { + A a{ this }; + }; + + void foo() + { + auto b = B{}; + } +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ24.C b/gcc/testsuite/g++.dg/cpp1y/var-templ24.C new file mode 100644 index 0000000000..d8f7cbf41e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ24.C @@ -0,0 +1,5 @@ +// { dg-do compile { target c++14 } } + +template <class T> bool Foo = Foo<int>; +template <> bool Foo<int> = true; +int i = Foo<char>; diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ25.C b/gcc/testsuite/g++.dg/cpp1y/var-templ25.C new file mode 100644 index 0000000000..8253eac5cd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ25.C @@ -0,0 +1,8 @@ +// { dg-do compile { target c++14 } } + +using fl = float; + +template<class T> const int V = 0; +template<> const int V<fl> = 42; + +static_assert(V<float> == 42, ""); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ26.C b/gcc/testsuite/g++.dg/cpp1y/var-templ26.C new file mode 100644 index 0000000000..9ac077773a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ26.C @@ -0,0 +1,19 @@ +// { dg-do compile { target c++14 } } + +template <class T> const int V = 0; +template <> const int V<char> = 42; + +template <class T> +struct A +{ + using N = T; +}; + +#define SA(X) static_assert((X),#X) +template <class T> +struct B +{ + SA(V<typename A<T>::N> == 42); +}; + +B<char> b; diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ27.C b/gcc/testsuite/g++.dg/cpp1y/var-templ27.C new file mode 100644 index 0000000000..da06b0123a --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ27.C @@ -0,0 +1,9 @@ +// { dg-do compile { target c++14 } } + +namespace A +{ + template <class T> int I = 0; + template <class T> int I<T*> = 42; +} + +int i = A::I<void*>; diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ29.C b/gcc/testsuite/g++.dg/cpp1y/var-templ29.C new file mode 100644 index 0000000000..22f5b0bc09 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ29.C @@ -0,0 +1,13 @@ +// PR c++/65719 +// { dg-do link { target c++14 } } + +struct FunctionObject { + void operator()() const { } +}; + +template <typename T> +constexpr FunctionObject f{}; + +int main() { + f<int>(); +} diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ30.C b/gcc/testsuite/g++.dg/cpp1y/var-templ30.C new file mode 100644 index 0000000000..e89aa7c2f2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ30.C @@ -0,0 +1,19 @@ +// PR c++/66536 +// { dg-do compile { target c++14 } } + +template <typename> struct make_impl; +struct Tuple; +template <> struct make_impl<Tuple> {}; +struct A { + template <typename X> auto operator()(X) { return make_impl<Tuple>(); } +}; +template <typename> A make; +template <typename _Tp, int> struct array { _Tp _M_elems; }; +struct Tracked { + Tracked(int); +}; +struct B { + Tracked tracker{0}; +}; +template <int> using ct_eq = B; +auto eq_arrays = make<Tuple>(array<ct_eq<0>, 0>{}); diff --git a/gcc/testsuite/g++.dg/cpp1y/var-templ31.C b/gcc/testsuite/g++.dg/cpp1y/var-templ31.C new file mode 100644 index 0000000000..e2bc59bd48 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp1y/var-templ31.C @@ -0,0 +1,8 @@ +// PR c++/66061 +// { dg-do compile { target c++14 } } + +template<int...> +int x = 1; + +template<int n, int... m> +int x<n, m...> = 1; |