diff options
author | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-02-22 17:22:08 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-02-22 17:22:08 +0000 |
commit | 6484413978b4b3ede2bfe2b67c3a64c65bc0f28b (patch) | |
tree | 97d14c6fc2b1b36249dd0c7282e7310a42090995 /gcc/cp | |
parent | f8190ffc6cf4cb616b423b930395ffd284688e28 (diff) | |
download | gcc-6484413978b4b3ede2bfe2b67c3a64c65bc0f28b.zip gcc-6484413978b4b3ede2bfe2b67c3a64c65bc0f28b.tar.gz gcc-6484413978b4b3ede2bfe2b67c3a64c65bc0f28b.tar.bz2 |
re PR c++/26291 (Invalid ellipsis in operator not diagnosed)
PR c++/26291
* decl.c (grok_op_properties): Check for ellipsis in arguments of
operators.
* g++.dg/other/ellipsis1.C: New test.
* g++.dg/parse/operator4.C: Adjust error marker.
From-SVN: r111367
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/ChangeLog | 13 | ||||
-rw-r--r-- | gcc/cp/decl.c | 7 |
2 files changed, 16 insertions, 4 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6a1e2f1..c888a09 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,6 +1,13 @@ -2006-02-20 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> - * Make-lang.in (C++): Remove - (.PHONY): Remove C++ +2006-02-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de> + + PR c++/26291 + * decl.c (grok_op_properties): Check for ellipsis in arguments of + operators. + +2006-02-20 Rafael Ávila de Espíndola <rafael.espindola@gmail.com> + + * Make-lang.in (C++): Remove. + (.PHONY): Remove C++. 2006-02-18 Mark Mitchell <mark@codesourcery.com> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c index 35dc38c..c803a84 100644 --- a/gcc/cp/decl.c +++ b/gcc/cp/decl.c @@ -8828,13 +8828,15 @@ grok_op_properties (tree decl, bool complain) tree name = DECL_NAME (decl); enum tree_code operator_code; int arity; + bool ellipsis_p; tree class_type; - /* Count the number of arguments. */ + /* Count the number of arguments and check for ellipsis. */ for (argtype = argtypes, arity = 0; argtype && argtype != void_list_node; argtype = TREE_CHAIN (argtype)) ++arity; + ellipsis_p = !argtype; class_type = DECL_CONTEXT (decl); if (class_type && !CLASS_TYPE_P (class_type)) @@ -9000,11 +9002,14 @@ grok_op_properties (tree decl, bool complain) "conversion operator", ref ? "a reference to " : "", what); } + if (operator_code == COND_EXPR) { /* 13.4.0.3 */ error ("ISO C++ prohibits overloading operator ?:"); } + else if (ellipsis_p) + error ("%qD must not have variable number of arguments", decl); else if (ambi_op_p (operator_code)) { if (arity == 1) |