re PR c++/51107 ([C++11] Accepts invalid literal operator with void argument list.)

PR c++/51107
	* typeck.c (check_literal_operator_args): Add processing_specialization
	to check for void template fn. Test for exact arity for non-template fn.

From-SVN: r181363
This commit is contained in:
Ed Smith-Rowland 2011-11-14 20:05:12 +00:00 committed by Jason Merrill
parent eab880cf62
commit d2027d2a83
4 changed files with 18 additions and 4 deletions

View File

@ -1,3 +1,9 @@
2011-11-14 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/51107
* typeck.c (check_literal_operator_args): Add processing_specialization
to check for void template fn. Test for exact arity for non-template fn.
2011-11-14 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/6936

View File

@ -8423,9 +8423,8 @@ check_literal_operator_args (const_tree decl,
bool *long_long_unsigned_p, bool *long_double_p)
{
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
if (processing_template_decl)
return (argtypes == NULL_TREE
|| same_type_p (TREE_VALUE (argtypes), void_type_node));
if (processing_template_decl || processing_specialization)
return argtypes == void_list_node;
else
{
tree argtype;
@ -8494,7 +8493,7 @@ check_literal_operator_args (const_tree decl,
if (!argtype)
return false; /* Found ellipsis. */
if (arity > max_arity)
if (arity != max_arity)
return false;
return true;

View File

@ -1,3 +1,9 @@
2011-11-14 Ed Smith-Rowland <3dw4rd@verizon.net>
PR c++/51107
* g++.dg/cpp0x/udlit-args-neg.C: Add check for void argument non-
template literal operator.
2011-11-14 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/sse4_1-floor-sfix-vec.c: New test.

View File

@ -4,6 +4,9 @@
class Foo { };
int
operator"" _Foo(); // { dg-error "has invalid argument list" }
Foo
operator"" _Foo(int *); // { dg-error "has invalid argument list" }