2010-07-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44969
* typeck.c (build_x_compound_expr_from_list): Add tsubst_flags_t
parameter.
* cp-tree.h: Adjust declaration.
* init.c (perform_member_init): Adjust caller.
* decl.c (grok_reference_init, cp_finish_decl): Likewise.
* typeck2.c (store_init_value): Likewise.
(build_functional_cast): Pass complain argument to
build_x_compound_expr_from_list.
/testsuite
2010-07-19 Paolo Carlini <paolo.carlini@oracle.com>
PR c++/44969
* g++.dg/template/sfinae23.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@162303
138bc75d-0d04-0410-961f-
82ee72b054a4
+2010-07-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44969
+ * typeck.c (build_x_compound_expr_from_list): Add tsubst_flags_t
+ parameter.
+ * cp-tree.h: Adjust declaration.
+ * init.c (perform_member_init): Adjust caller.
+ * decl.c (grok_reference_init, cp_finish_decl): Likewise.
+ * typeck2.c (store_init_value): Likewise.
+ (build_functional_cast): Pass complain argument to
+ build_x_compound_expr_from_list.
+
2010-07-16 Jason Merrill <jason@redhat.com>
PR c++/32505
extern tree unary_complex_lvalue (enum tree_code, tree);
extern tree build_x_conditional_expr (tree, tree, tree,
tsubst_flags_t);
-extern tree build_x_compound_expr_from_list (tree, expr_list_kind);
+extern tree build_x_compound_expr_from_list (tree, expr_list_kind,
+ tsubst_flags_t);
extern tree build_x_compound_expr_from_vec (VEC(tree,gc) *, const char *);
extern tree build_x_compound_expr (tree, tree, tsubst_flags_t);
extern tree build_compound_expr (location_t, tree, tree);
}
if (TREE_CODE (init) == TREE_LIST)
- init = build_x_compound_expr_from_list (init, ELK_INIT);
+ init = build_x_compound_expr_from_list (init, ELK_INIT,
+ tf_warning_or_error);
if (TREE_CODE (TREE_TYPE (type)) != ARRAY_TYPE
&& TREE_CODE (TREE_TYPE (init)) == ARRAY_TYPE)
return;
}
if (TREE_CODE (init) == TREE_LIST)
- init = build_x_compound_expr_from_list (init, ELK_INIT);
+ init = build_x_compound_expr_from_list (init, ELK_INIT,
+ tf_warning_or_error);
if (describable_type (init))
{
type = TREE_TYPE (decl) = do_auto_deduction (type, init, auto_node);
else if (TREE_CODE (init) == TREE_LIST)
/* There was an explicit member initialization. Do some work
in that case. */
- init = build_x_compound_expr_from_list (init, ELK_MEM_INIT);
+ init = build_x_compound_expr_from_list (init, ELK_MEM_INIT,
+ tf_warning_or_error);
if (init)
finish_expr_stmt (cp_build_modify_expr (decl, INIT_EXPR, init,
that performs them all and returns the value of the last of them. */
tree
-build_x_compound_expr_from_list (tree list, expr_list_kind exp)
+build_x_compound_expr_from_list (tree list, expr_list_kind exp,
+ tsubst_flags_t complain)
{
tree expr = TREE_VALUE (list);
if (TREE_CHAIN (list))
{
- switch (exp)
- {
+ if (complain & tf_error)
+ switch (exp)
+ {
case ELK_INIT:
permerror (input_location, "expression list treated as compound "
"expression in initializer");
break;
default:
gcc_unreachable ();
- }
+ }
for (list = TREE_CHAIN (list); list; list = TREE_CHAIN (list))
expr = build_x_compound_expr (expr, TREE_VALUE (list),
- tf_warning_or_error);
+ complain);
}
return expr;
}
else
/* We get here with code like `int a (2);' */
- init = build_x_compound_expr_from_list (init, ELK_INIT);
+ init = build_x_compound_expr_from_list (init, ELK_INIT,
+ tf_warning_or_error);
}
/* End of special C++ code. */
return cp_convert (type, integer_zero_node);
/* This must build a C cast. */
- parms = build_x_compound_expr_from_list (parms, ELK_FUNC_CAST);
+ parms = build_x_compound_expr_from_list (parms, ELK_FUNC_CAST, complain);
return cp_build_c_cast (type, parms, complain);
}
+2010-07-19 Paolo Carlini <paolo.carlini@oracle.com>
+
+ PR c++/44969
+ * g++.dg/template/sfinae23.C: New.
+
2010-07-19 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* lib/target-supports.exp (check_sse_os_support_available): New
--- /dev/null
+// PR c++/44969
+// { dg-options "-std=c++0x" }
+
+template<typename Tp, typename... Args>
+ class mini_is_constructible
+ {
+ typedef char one;
+ typedef struct { char arr[2]; } two;
+
+ template<typename Tp1, typename... Args1>
+ static decltype(Tp1(Args1()...), one())
+ test(int);
+
+ template<typename, typename...>
+ static two test(...);
+
+ public:
+ static const bool value = sizeof(test<Tp, Args...>(0)) == 1;
+ };
+
+class A { };
+
+int Test[mini_is_constructible<int, A, A>::value ? -1 : 1];