* 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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111367
138bc75d-0d04-0410-961f-
82ee72b054a4
-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>
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))
"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)
+2006-02-22 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+
+ PR c++/26291
+ * g++.dg/other/ellipsis1.C: New test.
+ * g++.dg/parse/operator4.C: Adjust error marker.
+
2006-02-22 H.J. Lu <hongjiu.lu@intel.com>
PR target/25603
--- /dev/null
+// PR c++/26291
+// { dg-do compile }
+
+struct A
+{
+ A& operator= (A,...); // { dg-error "variable number of arguments" }
+ A operator+ (...); // { dg-error "variable number of arguments" }
+ operator int(...); // { dg-error "variable number of arguments" }
+ int operator() (...);
+};
+
+A operator- (A,...); // { dg-error "variable number of arguments" }
-int operator *(int, ...); // { dg-error "class" }
+int operator *(int, ...); // { dg-error "class|variable number of arguments" }