diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x')
24 files changed, 395 insertions, 22 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C index 856e4297af5..733e791c2bc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-10.C @@ -3,16 +3,24 @@ template <class T> using Ptr = T*; Ptr<unsigned>; // { dg-error "does not declare anything" } Ptr<char><int>; // { dg-error "not a template|does not declare anything" } -template class Ptr<int>;//{ dg-error "explicit instantiation|non-class templ|does not decl|anything" } +template class Ptr<int>;//{ dg-error "alias template specialization\[^\n\r\]*after\[^\n\r\]*class" } template <class T> using Arg = T; struct A {}; -template class Arg<A>;// { dg-error "explicit instantiation|non-class templ" } +template class Arg<A>;// { dg-error "alias templ\[^\n\r\]*specialization\[^\n\r\]*Arg<A>\[^\n\r\]*after\[^\n\r\]*class" } template <template <class> class TT, class T> using Instantiate = TT<T>; template <class> struct Vector {}; -template class Instantiate<Vector, int>; // OK Vector<int> can be explicitely instantiated + +// The below is not OK, because of [dcl.type.elab]: +// +// If the identifier resolves to a typedef-name or the +// simple-template-id resolves to an alias template +// specialization, the elaborated-type-specifier is ill-formed. +// +template class Instantiate<Vector, int>;//{ dg-error "alias template specialization\[^\n\r\]*after\[^\n\r\]*class" } template <class T> struct S {}; template<class T> using SFor = S<T>; -template class SFor<int>; // OK, S<int> can be explicitely instantiated +// Likewise, this is not OK. +template class SFor<int>; //{ dg-error "alias template specialization\[^\n\r\]*after\[^\n\r\]*class" } diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C new file mode 100644 index 00000000000..8555154c634 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-13.C @@ -0,0 +1,24 @@ +// Origin PR c++/51191 +// { dg-options "-std=c++0x" } + +template< class T > +class ClassTemplate {}; + +template< class T > +struct Metafunction { + typedef T type; +}; + +template< class T > +using TemplateAlias = ClassTemplate< typename Metafunction<T>::type >; + +using Alias = TemplateAlias<int>; + +template< class T > +void f( TemplateAlias<T> ); + +int main() +{ + Alias x; + f( x ); // { dg-error "no matching function for call to|f" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-14.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-14.C new file mode 100644 index 00000000000..1a998022adc --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-14.C @@ -0,0 +1,14 @@ +// Origin: PR c++/51145 +// { dg-options "-std=c++0x" } + +struct A {}; + +template<class> +using X = A; + +struct X<int>* px; // { dg-error "using\[^\n\r\]*alias\[^\n\r\]*specialization\[^\n\r\]*X<int>\[^\n\r\]*after\[^\n\r\]*struct|invalid type in declaration before\[^\n\r\]*;" } + +template<int> +using Y = A; + +struct Y<0>* py;// { dg-error "alias\[^\n\r\]*specialization\[^\n\r\]*Y<0>\[^\n\r\]*after\[^\n\r\]*struct|invalid type in declaration before\[^\n\r\]*;" } diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C new file mode 100644 index 00000000000..2bc9b11843d --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-15.C @@ -0,0 +1,17 @@ +// Origin PR c++/51194 +// { dg-options "-std=c++0x" } + +template<class U, class V> //#1 +struct foo {}; // { dg-error "provided for|foo" } + +template<class U, class V=char> +struct P {}; + +template<template<class... U> class... TT> +struct bar { + template<class... Args> + using mem = P<TT<Args...>...>;//#2 { dg-error "wrong number of|arguments" } +}; + +bar<foo>::mem<int, char> b;//#3 { dg-error "invalid type" } + diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C new file mode 100644 index 00000000000..d66660a5f4e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-16.C @@ -0,0 +1,28 @@ +// Origin PR c++/51143 +// { dg-options "-std=c++11" } + +using A0 = struct B0 { void f() {} }; + +template<int N> +using A1 = + struct B1 { // { dg-error "types may not be defined in alias template" } + static auto constexpr value = N; + }; + +A1<0> a1; + +template<class T> +using A2 = + struct B2 { // { dg-error "types may not be defined in alias template" } + void f(T){} + }; + +A2<bool> a2; + +template<class T> +using A3 = + enum B3 {b = 0;}; //{ dg-error "types may not be defined in alias template" } + +A3<int> a3; + +int main() { } diff --git a/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C b/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C index 2e03dd897b5..6b5b42f7fde 100644 --- a/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C +++ b/gcc/testsuite/g++.dg/cpp0x/alias-decl-2.C @@ -6,7 +6,7 @@ template<class T> using AS0 = S0<T>; template<template<class> class TT> void f(TT<int>); -template class AS0<char>; +template class AS0<char>; // { dg-error "alias templ\[^\n\r\]*specialization\[^\n\r\]*after\[^\n\r\]*class" } void foo() diff --git a/gcc/testsuite/g++.dg/cpp0x/auto27.C b/gcc/testsuite/g++.dg/cpp0x/auto27.C new file mode 100644 index 00000000000..c1041df54b0 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/auto27.C @@ -0,0 +1,6 @@ +// PR c++/51186 + +auto main()->int // { dg-error "std=" "" { target c++98 } } + // { dg-error "auto" "" { target c++98 } 3 } + // { dg-error "no type" "" { target c++98 } 3 } +{ } diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype36.C b/gcc/testsuite/g++.dg/cpp0x/decltype36.C new file mode 100644 index 00000000000..f3dfed992cf --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/decltype36.C @@ -0,0 +1,21 @@ +// PR c++/51265 +// { dg-options -std=c++0x } + +struct Funny +{ + int print(int); +}; + +template<typename X> +void c(); + +template<typename X, X ff> +void xx() +{ + c<decltype(ff)>(); +} + +int main() +{ + xx<int(Funny::*)(int), &Funny::print>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C b/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C new file mode 100644 index 00000000000..a57c0a9f415 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/forw_enum10.C @@ -0,0 +1,31 @@ +// { dg-do compile } +// { dg-options "-std=c++0x" } + +//This error is diagnosed at instantiation time +template<typename T> struct S1 +{ + enum E : T; // { dg-error "previous definition" } + enum E : int; // { dg-error "different underlying type" } +}; +template struct S1<short>; // { dg-message "required from here" } + +template<typename T> struct S2 +{ + enum E : T; + enum E : T; +}; +template struct S2<short>; + +template<typename T1, typename T2> struct S3 +{ + enum E : T1; + enum E : T2; +}; +template struct S3<short,short>; + +template<typename T1, typename T2> struct S4 +{ + enum E : T1; // { dg-error "previous definition" } + enum E : T2; // { dg-error "different underlying type" } +}; +template struct S4<short,char>; // { dg-message "required from here" } diff --git a/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C new file mode 100644 index 00000000000..305db812d82 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/lambda/lambda-ice5.C @@ -0,0 +1,12 @@ +// PR c++/51227 +// { dg-options "-std=c++0x" } + +template<int> int foo() +{ + [] (void i) { return 0; } (0); // { dg-error "incomplete|invalid|no match" } +} + +void bar() +{ + foo<0>(); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51150.C b/gcc/testsuite/g++.dg/cpp0x/pr51150.C new file mode 100644 index 00000000000..37eb166b43e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr51150.C @@ -0,0 +1,20 @@ +// PR c++/51150 +// { dg-options "-std=c++0x" } + +struct Clock { + double Now(); +}; +template <class T> void Foo(Clock* clock) { + const int now = clock->Now(); +} + +template void Foo<float>(Clock*); + +template <class T> void Boo(int val) { + const int now1 = (double)(val); + const int now2 = const_cast<double>(val); // { dg-error "invalid" } + const int now3 = static_cast<double>(val); + const int now4 = reinterpret_cast<double>(val); // { dg-error "invalid" } +} + +template void Boo<float>(int); diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51216.C b/gcc/testsuite/g++.dg/cpp0x/pr51216.C new file mode 100644 index 00000000000..4bdd071475e --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr51216.C @@ -0,0 +1,10 @@ +// PR c++/51216 +// { dg-options "-std=c++0x" } + +void foo() +{ + int i = ({ if (1) ; }); // { dg-error "ignored" } + int j = ({ for (;;) ; }); // { dg-error "ignored" } + int k = ({ while (1) ; }); // { dg-error "ignored" } + int l = ({ do { } while (1); }); // { dg-error "ignored" } +} diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae11.C b/gcc/testsuite/g++.dg/cpp0x/sfinae11.C index 25902cbd65e..2e8408d8f4d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/sfinae11.C +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae11.C @@ -12,7 +12,8 @@ inline void f1( T& x ) noexcept( noexcept( declval<T&>().foo() ) ) // { dg-error } template< class T, - bool Noexcept = noexcept( declval<T&>().foo() ) + bool Noexcept = noexcept( declval<T&>().foo() ) // { dg-error "no member|not convert" } + > inline void f2( T& x ) noexcept( Noexcept ) { @@ -51,7 +52,6 @@ int main() // static_assert( noexcept( f3(y) ), "shall be ill-formed(OK)." ); noexcept( f1(z) ); // { dg-message "required" } - static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match|could not convert" } - // { dg-error "no member" "" { target *-*-* } 54 } + static_assert( noexcept( f2(z) ), "shall be ill-formed." ); // { dg-error "no match" } noexcept( f3(z) ); // { dg-message "required" } } diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae26.C b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C index 42b48eb5a6b..374f9976b2c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/sfinae26.C +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae26.C @@ -30,9 +30,9 @@ struct is_same<T, T> { template<class... T> struct S { template<class... U, - typename enable_if<and_<is_same<T, U>...>::value>::type*& = enabler + typename enable_if<and_<is_same<T, U>...>::value>::type*& = enabler // { dg-error "no type" } > - S(U...){} // { dg-error "no type named 'type'" } + S(U...){} }; S<bool> s(0); // { dg-error "no match" } diff --git a/gcc/testsuite/g++.dg/cpp0x/sfinae30.C b/gcc/testsuite/g++.dg/cpp0x/sfinae30.C new file mode 100644 index 00000000000..6fcf5f75609 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/sfinae30.C @@ -0,0 +1,25 @@ +// { dg-do compile { target c++11 } } + +template <class... T> struct tuple; +template <class T> struct tuple<T> { T t; }; + +template <class T, class U> struct pair; +template<> struct pair<int,double> { }; + +template <class... Ts> +struct A +{ + template <class... Us, + class V = tuple<pair<Ts,Us>...> > + static void f(Us...) + { + V v; + } + template <class U> + static void f(bool); +}; + +int main() +{ + A<int,float>::f<double>(1.0); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing2.C b/gcc/testsuite/g++.dg/cpp0x/trailing2.C index e45204fe715..5f5af22947f 100644 --- a/gcc/testsuite/g++.dg/cpp0x/trailing2.C +++ b/gcc/testsuite/g++.dg/cpp0x/trailing2.C @@ -3,14 +3,14 @@ // { dg-options "-std=c++0x" } auto f1 () -> int; -auto f2 (); // { dg-error "without late return type" } -int f3 () -> int; // { dg-error "late return type" } -auto *f4 () -> int; // { dg-error "late return type" } +auto f2 (); // { dg-error "without trailing return type" } +int f3 () -> int; // { dg-error "trailing return type" } +auto *f4 () -> int; // { dg-error "trailing return type" } struct A { auto f5 () const -> int; - auto f6 (); // { dg-error "without late return type" } - int f7 () -> int; // { dg-error "late return type" } - auto *f8 () -> int; // { dg-error "late return type" } + auto f6 (); // { dg-error "without trailing return type" } + int f7 () -> int; // { dg-error "trailing return type" } + auto *f8 () -> int; // { dg-error "trailing return type" } }; diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C index cb924a249bf..df7b7281c3d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C @@ -4,6 +4,9 @@ class Foo { }; +int +operator"" _Foo(); // { dg-error "has invalid argument list" } + Foo operator"" _Foo(int *); // { dg-error "has invalid argument list" } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C index 7b50c017f01..9060abba494 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-declare-neg.C @@ -3,13 +3,13 @@ // Check that undeclared literal operator calls and literals give appropriate errors. int i = operator"" _Bar('x'); // { dg-error "was not declared in this scope" } -int j = 'x'_Bar; // { dg-error "unable to find user-defined character literal operator" } +int j = 'x'_Bar; // { dg-error "unable to find character literal operator|with|argument" } int ii = operator"" _BarCharStr("Howdy, Pardner!"); // { dg-error "was not declared in this scope" } -int jj = "Howdy, Pardner!"_BarCharStr; // { dg-error "unable to find user-defined string literal operator" } +int jj = "Howdy, Pardner!"_BarCharStr; // { dg-error "unable to find string literal operator|Possible missing length argument" } unsigned long long iULL = operator"" _BarULL(666ULL); // { dg-error "was not declared in this scope" } -unsigned long long jULL = 666_BarULL; // { dg-error "unable to find user-defined numeric literal operator" } +unsigned long long jULL = 666_BarULL; // { dg-error "unable to find numeric literal operator" } long double iLD = operator"" _BarLD(666.0L); // { dg-error "was not declared in this scope" } -long double jLD = 666.0_BarLD; // { dg-error "unable to find user-defined numeric literal operator" } +long double jLD = 666.0_BarLD; // { dg-error "unable to find numeric literal operator" } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C new file mode 100644 index 00000000000..998ad155bf7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-implicit-conv-neg.C @@ -0,0 +1,63 @@ +// { dg-options -std=c++0x } + +#include <cstdint> + +int operator"" _bar (long double); + +double operator"" _foo (long long unsigned); + +int i = 12_bar; // { dg-error "unable to find numeric literal operator|with|argument" } + +double d = 1.2_foo; // { dg-error "unable to find numeric literal operator|with|argument" } + +int operator"" _char(char); + +int operator"" _wchar_t(wchar_t); + +int operator"" _char16_t(char16_t); + +int operator"" _char32_t(char32_t); + +int cwcx = 'c'_wchar_t; // { dg-error "unable to find character literal operator|with|argument" } +int cc16 = 'c'_char16_t; // { dg-error "unable to find character literal operator|with|argument" } +int cc32 = 'c'_char32_t; // { dg-error "unable to find character literal operator|with|argument" } + +int wccx = L'c'_char; // { dg-error "unable to find character literal operator|with|argument" } +int wcc16 = L'c'_char16_t; // { dg-error "unable to find character literal operator|with|argument" } +int wcc32 = L'c'_char32_t; // { dg-error "unable to find character literal operator|with|argument" } + +int c16c = u'c'_char; // { dg-error "unable to find character literal operator|with|argument" } +int c16wc = u'c'_wchar_t; // { dg-error "unable to find character literal operator|with|argument" } +int c16c32 = u'c'_char32_t; // { dg-error "unable to find character literal operator|with|argument" } + +int c32c = U'c'_char; // { dg-error "unable to find character literal operator|with|argument" } +int c32wc = U'c'_wchar_t; // { dg-error "unable to find character literal operator|with|argument" } +int c32c16 = U'c'_char16_t; // { dg-error "unable to find character literal operator|with|argument" } + +int operator"" _char_str(const char*, std::size_t); + +int operator"" _wchar_t_str(const wchar_t*, std::size_t); + +int operator"" _char16_t_str(const char16_t*, std::size_t); + +int operator"" _char32_t_str(const char32_t*, std::size_t); + +int strwstr = "str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int strstr16 = "str"_char16_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int strstr32 = "str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" } + +int str8wstr = u8"str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int str8str16 = u8"str"_char16_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int str8str32 = u8"str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" } + +int wstrstr = L"str"_char_str; // { dg-error "unable to find string literal operator|with|arguments" } +int wstrstr16 = L"str"_char16_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int wstrstr32 = L"str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" } + +int str16str = u"str"_char_str; // { dg-error "unable to find string literal operator|with|arguments" } +int str16wstr = u"str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int str16str32 = u"str"_char32_t_str; // { dg-error "unable to find string literal operator|with|arguments" } + +int str32str = U"str"_char_str; // { dg-error "unable to find string literal operator|with|arguments" } +int str32wstr = U"str"_wchar_t_str; // { dg-error "unable to find string literal operator|with|arguments" } +int str32str16 = U"str"_char16_t_str; // { dg-error "unable to find string literal operator string operator|with|arguments" } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C index 809df254c0e..a6220c4c0fc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-member-neg.C @@ -8,7 +8,7 @@ public: }; int i = operator"" _Bar(U'x'); // { dg-error "was not declared in this scope" } -int j = U'x'_Bar; // { dg-error "unable to find user-defined character literal operator" } +int j = U'x'_Bar; // { dg-error "unable to find character literal operator" } int Foo::operator"" _Bar(char32_t) // { dg-error "must be a non-member function" } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C new file mode 100644 index 00000000000..2d910624a7c --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-length.C @@ -0,0 +1,27 @@ +// { dg-options "-std=c++0x" } +// PR c++/50958 + +typedef decltype(sizeof(0)) size_type; + +constexpr size_type +cstrlen_impl(const char* s, size_type i) +{ + return s[i] ? cstrlen_impl(s, i + 1) : i; +} + +constexpr size_type +cstrlen(const char* s) +{ + return s ? cstrlen_impl(s, 0) : throw 0; +} + +constexpr size_type +operator "" _lenraw(const char* digits) +{ + return cstrlen(digits); +} + +static_assert(123_lenraw == 3, "Ouch"); +static_assert(1_lenraw == 1, "Ouch"); +static_assert(012_lenraw == 3, "Ouch"); +static_assert(0_lenraw == 1, "Ouch"); diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C index 5c399aff599..58ad0e609d0 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-raw-op-string-neg.C @@ -5,4 +5,4 @@ int operator"" _embedraw(const char*) { return 41; }; -int k = "Boo!"_embedraw; // { dg-error "unable to find valid user-defined string literal operator" } +int k = "Boo!"_embedraw; // { dg-error "unable to find string literal operator" } diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C b/gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C new file mode 100644 index 00000000000..a25516220c2 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-resolve.C @@ -0,0 +1,40 @@ +// { dg-do run } +// { dg-options "-std=c++0x" } + +#include <cstdint> +#include <cassert> + +int operator"" _foo(const char*) { return 0; } +int operator"" _foo(unsigned long long int) { return 1; } +int operator"" _foo(long double) { return 2; } +int operator"" _foo(char) { return 3; } +int operator"" _foo(wchar_t) { return 4; } +int operator"" _foo(char16_t) { return 5; } +int operator"" _foo(char32_t) { return 6; } +int operator"" _foo(const char*, std::size_t) { return 7; } +int operator"" _foo(const wchar_t*, std::size_t) { return 8; } +int operator"" _foo(const char16_t*, std::size_t) { return 9; } +int operator"" _foo(const char32_t*, std::size_t) { return 10; } +template<char...> int operator"" _foo2() { return 20; } +int operator"" _foo2(unsigned long long int) { return 21; } + +namespace bar { +int operator"" _foo(unsigned long long int) { return 101; } +} +using namespace bar; + +int +main() +{ + assert(123_foo == 101); + assert(0.123_foo == 2); + assert('c'_foo == 3); + assert(L'c'_foo == 4); + assert(u'c'_foo == 5); + assert(U'c'_foo == 6); + assert("abc"_foo == 7); + assert(L"abc"_foo == 8); + assert(u"abc"_foo == 9); + assert(U"abc"_foo == 10); + assert(123_foo2 == 21); +} diff --git a/gcc/testsuite/g++.dg/cpp0x/variadic120.C b/gcc/testsuite/g++.dg/cpp0x/variadic120.C new file mode 100644 index 00000000000..e26ee4e9abe --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/variadic120.C @@ -0,0 +1,24 @@ +// PR c++/48322 +// { dg-do compile { target c++11 } } + +template <class... T> struct tuple; +template <class T> struct tuple<T> { T t; }; + +template <class T, class U> struct pair; +template<> struct pair<int,double> { }; + +template <class... Ts> +struct A +{ + template <class... Us, + class V = tuple<pair<Ts,Us>...> > + static void f() + { + V v; + } +}; + +int main() +{ + A<int>::f<double>(); +} |