diff options
author | reichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-08 17:03:33 +0000 |
---|---|---|
committer | reichelt <reichelt@138bc75d-0d04-0410-961f-82ee72b054a4> | 2005-08-08 17:03:33 +0000 |
commit | db6ec059e0827e5e70eb7e97bcf07918f288093c (patch) | |
tree | 8234b147922b6a2573e6d3c065e6c0a72c97a9d1 /gcc/cp/init.c | |
parent | 4346c45ed9c7d7d98b9fd6d49d26d650401eba16 (diff) | |
download | gcc-db6ec059e0827e5e70eb7e97bcf07918f288093c.tar.gz |
PR c++/22508
* init.c (build_new_1): Check for empty candidate list.
* g++.dg/init/new13.C: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@102863 138bc75d-0d04-0410-961f-82ee72b054a4
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 9383e928fa5..a2fcc1ffe60 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); |