diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2005-08-08 17:03:33 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2005-08-08 17:03:33 +0000 |
commit | a85cb0d7f0ee12bfa2fdb29972783206c8f8e38f (patch) | |
tree | 8234b147922b6a2573e6d3c065e6c0a72c97a9d1 /gcc/cp/init.c | |
parent | 7a4eca6648367a620e21a4a18d0deca5b3f863e0 (diff) | |
download | gcc-a85cb0d7f0ee12bfa2fdb29972783206c8f8e38f.zip gcc-a85cb0d7f0ee12bfa2fdb29972783206c8f8e38f.tar.gz gcc-a85cb0d7f0ee12bfa2fdb29972783206c8f8e38f.tar.bz2 |
re PR c++/22508 (ICE after invalid operator new)
PR c++/22508
* init.c (build_new_1): Check for empty candidate list.
* g++.dg/init/new13.C: New test.
From-SVN: r102863
Diffstat (limited to 'gcc/cp/init.c')
-rw-r--r-- | gcc/cp/init.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 9383e92..a2fcc1f 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -1918,6 +1918,11 @@ build_new_1 (tree exp) args = tree_cons (NULL_TREE, size, placement); /* Do name-lookup to find the appropriate operator. */ fns = lookup_fnfields (elt_type, fnname, /*protect=*/2); + if (fns == NULL_TREE) + { + error ("no suitable %qD found in class %qT", fnname, elt_type); + return error_mark_node; + } if (TREE_CODE (fns) == TREE_LIST) { error ("request for member %qD is ambiguous", fnname); |