diff options
author | Jason Merrill <jason@redhat.com> | 2011-04-07 17:47:10 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-04-07 17:47:10 -0400 |
commit | 2b8497cd7aef2697b00b7e57ae3ea787f7cbe251 (patch) | |
tree | 283bd508dcdce7684a9caf0e7849659f2fbe008e /gcc/cp/init.c | |
parent | 6cdb14286db4ace59759757ce2b1fab2d03a04c2 (diff) | |
download | gcc-2b8497cd7aef2697b00b7e57ae3ea787f7cbe251.zip gcc-2b8497cd7aef2697b00b7e57ae3ea787f7cbe251.tar.gz gcc-2b8497cd7aef2697b00b7e57ae3ea787f7cbe251.tar.bz2 |
re PR c++/48449 ([C++0x][SFINAE] Hard errors during value-initialization expressions)
PR c++/48449
* typeck2.c (build_functional_cast): Check complain consistently.
Use build_value_init and abstract_virtuals_error_sfinae.
(abstract_virtuals_error_sfinae): Split out.
* cp-tree.h: Declare it.
* init.c (build_new_1): Use it.
(build_value_init_noctor): Handle FUNCTION_TYPE.
From-SVN: r172141
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index e1961c8..2e9eb680 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -458,6 +458,12 @@ build_value_init_noctor (tree type, tsubst_flags_t complain) /* Build a constructor to contain the initializations. */ return build_constructor (type, v); } + else if (TREE_CODE (type) == FUNCTION_TYPE) + { + if (complain & tf_error) + error ("value-initialization of function type %qT", type); + return error_mark_node; + } return build_zero_init (type, NULL_TREE, /*static_storage_p=*/false); } @@ -2030,7 +2036,7 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts, return error_mark_node; } - if (abstract_virtuals_error (NULL_TREE, elt_type)) + if (abstract_virtuals_error_sfinae (NULL_TREE, elt_type, complain)) return error_mark_node; is_initialized = (TYPE_NEEDS_CONSTRUCTING (elt_type) || *init != NULL); |