diff options
author | Jason Merrill <jason@redhat.com> | 2009-11-03 13:43:06 -0500 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2009-11-03 13:43:06 -0500 |
commit | aa9b756937a80e557f1c983d37ce1423c3afc2b2 (patch) | |
tree | 8a425ade42a069bc27caf86c3a2b7a4918ff3ec5 /gcc/testsuite | |
parent | a638b034245e39678a9f24b823df0bba0f1453d0 (diff) | |
download | gcc-aa9b756937a80e557f1c983d37ce1423c3afc2b2.zip gcc-aa9b756937a80e557f1c983d37ce1423c3afc2b2.tar.gz gcc-aa9b756937a80e557f1c983d37ce1423c3afc2b2.tar.bz2 |
re PR c++/41927 ([C++0x] Spurious warning with enable_if and default function template argument)
PR c++/41927
* typeck.c (build_x_binary_op): Don't do warn_parentheses
if we're in a SFINAE context.
From-SVN: r153863
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/sfinae16.C | 34 |
2 files changed, 37 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0371d4a..dc49db0 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2009-11-03 Jason Merrill <jason@redhat.com> + PR c++/41927 + * g++.dg/template/sfinae16.C: New. + PR c++/41815 * g++.dg/cpp0x/rv-return.C: New. * g++.dg/cpp0x/deduce.C: Adjust. diff --git a/gcc/testsuite/g++.dg/template/sfinae16.C b/gcc/testsuite/g++.dg/template/sfinae16.C new file mode 100644 index 0000000..5ea564c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/sfinae16.C @@ -0,0 +1,34 @@ +// PR c++/41927 +// { dg-options "-std=c++0x -Wall" } + +// We were getting a spurious ||/&& warning about the enable_if with the +// source position of d1. + +template<typename Tp> + struct is_int + { static const bool value = true; }; + +template<bool, typename Tp = void> + struct enable_if + { }; + +template<typename Tp> + struct enable_if<true, Tp> + { typedef Tp type; }; + +template<typename Rep> + struct duration + { + duration() { } + + template<typename Rep2, typename = typename + enable_if<false || (true && is_int<Rep2>::value)>::type> + duration(const duration<Rep2>&) { } + }; + +int main() +{ + duration<int> d0; + duration<int> d1 = d0; +} + |