Commit a1e03bc5 by Jason Merrill Committed by Jason Merrill

re PR c++/55241 ([C++11] diagnostics show sizeof...(T) as sizeof(T...))

	PR c++/55241
	* error.c (dump_expr) [SIZEOF_EXPR]: Print sizeof... properly.

From-SVN: r196726
parent d09b76f1
2013-03-16 Jason Merrill <jason@redhat.com>
PR c++/55241
* error.c (dump_expr) [SIZEOF_EXPR]: Print sizeof... properly.
* parser.c (lookup_literal_operator): Correct parm/arg naming
mixup.
......
......@@ -1783,6 +1783,8 @@ resolve_virtual_fun_from_obj_type_ref (tree ref)
static void
dump_expr (tree t, int flags)
{
tree op;
if (t == 0)
return;
......@@ -2316,14 +2318,20 @@ dump_expr (tree t, int flags)
gcc_assert (TREE_CODE (t) == ALIGNOF_EXPR);
pp_cxx_ws_string (cxx_pp, "__alignof__");
}
op = TREE_OPERAND (t, 0);
if (PACK_EXPANSION_P (op))
{
pp_string (cxx_pp, "...");
op = PACK_EXPANSION_PATTERN (op);
}
pp_cxx_whitespace (cxx_pp);
pp_cxx_left_paren (cxx_pp);
if (TREE_CODE (t) == SIZEOF_EXPR && SIZEOF_EXPR_TYPE_P (t))
dump_type (TREE_TYPE (TREE_OPERAND (t, 0)), flags);
dump_type (TREE_TYPE (op), flags);
else if (TYPE_P (TREE_OPERAND (t, 0)))
dump_type (TREE_OPERAND (t, 0), flags);
dump_type (op, flags);
else
dump_expr (TREE_OPERAND (t, 0), flags);
dump_expr (op, flags);
pp_cxx_right_paren (cxx_pp);
break;
......
// PR c++/55241
// { dg-do compile { target c++11 } }
template<int N> struct B { };
template<typename... T> struct A
{
B<sizeof...(T)> f(); // { dg-error "sizeof\\.\\.\\." }
B<42> f(); // { dg-error "cannot be overloaded" }
};
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