Commit aa9b7569 by Jason Merrill Committed by Jason Merrill

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
parent a638b034
2009-11-03 Jason Merrill <jason@redhat.com>
PR c++/41927
* typeck.c (build_x_binary_op): Don't do warn_parentheses
if we're in a SFINAE context.
PR c++/41815
* call.c (build_call_a): Strip cv-quals from rvalue result.
......
......@@ -3245,6 +3245,7 @@ build_x_binary_op (enum tree_code code, tree arg1, enum tree_code arg1_code,
misinterpret. But don't warn about obj << x + y, since that is a
common idiom for I/O. */
if (warn_parentheses
&& (complain & tf_warning)
&& !processing_template_decl
&& !error_operand_p (arg1)
&& !error_operand_p (arg2)
......
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.
......
// 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment