From cb2e147086286e59c24e5eb1528c11bbdfa08d05 Mon Sep 17 00:00:00 2001 From: Paolo Carlini Date: Tue, 12 May 2015 09:03:04 +0000 Subject: [PATCH] re PR c++/65133 ([C++11] Result type deduction proceeds even though argument deduction fails) 2015-05-12 Paolo Carlini PR c++/65133 * g++.dg/cpp0x/trailing10.C: New. From-SVN: r223047 --- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/g++.dg/cpp0x/trailing10.C | 33 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 gcc/testsuite/g++.dg/cpp0x/trailing10.C diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3f5f347b5f5..37d18532017 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-05-12 Paolo Carlini + + PR c++/65133 + * g++.dg/cpp0x/trailing10.C: New. + 2015-05-12 Richard Biener * gcc.dg/vect/bb-slp-35.c: New testcase. diff --git a/gcc/testsuite/g++.dg/cpp0x/trailing10.C b/gcc/testsuite/g++.dg/cpp0x/trailing10.C new file mode 100644 index 00000000000..19ef57fa9ea --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/trailing10.C @@ -0,0 +1,33 @@ +// PR c++/65133 +// { dg-do compile { target c++11 } } + +template +struct enable_if { }; + +template +struct enable_if { typedef Tp type; }; + +template +struct count +{ + using type = typename count::type; +}; + +template <> +struct count<0> +{ + using type = void; +}; + +template +auto foo(typename enable_if<(I>=0)>::type * + = nullptr) -> typename count::type { } + +template +void foo(typename enable_if<(I<0)>::type * = nullptr) { } + +int main() +{ + foo<2>(); + foo<-1>(); +} -- 2.30.2