diff options
author | Jason Merrill <jason@yorick.cygnus.com> | 1997-09-17 02:23:05 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 1997-09-16 22:23:05 -0400 |
commit | d5467e204adf7c98864d02695dca7e09509ff42d (patch) | |
tree | 4c23ff793e5e9537e63ad7188c81210c27377ac9 | |
parent | 6c1d570678f1f1d82c5a202ed6f81005a6dee0ce (diff) | |
download | gcc-d5467e204adf7c98864d02695dca7e09509ff42d.zip gcc-d5467e204adf7c98864d02695dca7e09509ff42d.tar.gz gcc-d5467e204adf7c98864d02695dca7e09509ff42d.tar.bz2 |
call.c (build_new_op): Give better error for syntactically correct...
* call.c (build_new_op): Give better error for syntactically
correct, but semantically invalid, use of undeclared template.
From-SVN: r15506
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/call.c | 10 |
2 files changed, 12 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index edfddc9..148691b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ Tue Sep 16 14:06:56 1997 Jason Merrill <jason@yorick.cygnus.com> + * call.c (build_new_op): Give better error for syntactically + correct, but semantically invalid, use of undeclared template. + * call.c (compare_qual): Handle pmfs. * decl.c (store_parm_decls): last_parm_cleanup_insn is the insn diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 6836a6c..48b5abf 100644 --- a/gcc/cp/call.c +++ b/gcc/cp/call.c @@ -4421,7 +4421,7 @@ build_user_type_conversion_1 (totype, expr, flags) (USER_CONV, (DECL_CONSTRUCTOR_P (cand->fn) ? totype : non_reference (TREE_TYPE (TREE_TYPE (cand->fn)))), - NULL_TREE, cand->fn, cand->convs, cand->basetype_path); + expr, cand->fn, cand->convs, cand->basetype_path); ICS_USER_FLAG (cand->second_conv) = 1; if (cand->viable == -1) ICS_BAD_FLAG (cand->second_conv) = 1; @@ -4672,6 +4672,14 @@ build_new_op (code, flags, arg1, arg2, arg3) || arg3 == error_mark_node) return error_mark_node; + /* This can happen if a template takes all non-type parameters, e.g. + undeclared_template<1, 5, 72>a; */ + if (code == LT_EXPR && TREE_CODE (arg1) == TEMPLATE_DECL) + { + cp_error ("`%D' must be declared before use", arg1); + return error_mark_node; + } + if (code == MODIFY_EXPR) { code2 = TREE_CODE (arg3); |