mirror of
git://gcc.gnu.org/git/gcc.git
synced 2025-02-22 20:40:10 +08:00
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
This commit is contained in:
parent
f8190ffc6c
commit
6484413978
@ -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>
|
||||
|
||||
|
@ -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)
|
||||
|
@ -1,3 +1,9 @@
|
||||
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
|
||||
|
12
gcc/testsuite/g++.dg/other/ellipsis1.C
Normal file
12
gcc/testsuite/g++.dg/other/ellipsis1.C
Normal file
@ -0,0 +1,12 @@
|
||||
// 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" }
|
@ -1 +1 @@
|
||||
int operator *(int, ...); // { dg-error "class" }
|
||||
int operator *(int, ...); // { dg-error "class|variable number of arguments" }
|
||||
|
Loading…
Reference in New Issue
Block a user