Commit d2027d2a by Ed Smith-Rowland Committed by Jason Merrill

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
parent eab880cf
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> 2011-11-14 Fabien Chêne <fabien@gcc.gnu.org>
PR c++/6936 PR c++/6936
......
...@@ -8423,9 +8423,8 @@ check_literal_operator_args (const_tree decl, ...@@ -8423,9 +8423,8 @@ check_literal_operator_args (const_tree decl,
bool *long_long_unsigned_p, bool *long_double_p) bool *long_long_unsigned_p, bool *long_double_p)
{ {
tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl)); tree argtypes = TYPE_ARG_TYPES (TREE_TYPE (decl));
if (processing_template_decl) if (processing_template_decl || processing_specialization)
return (argtypes == NULL_TREE return argtypes == void_list_node;
|| same_type_p (TREE_VALUE (argtypes), void_type_node));
else else
{ {
tree argtype; tree argtype;
...@@ -8494,7 +8493,7 @@ check_literal_operator_args (const_tree decl, ...@@ -8494,7 +8493,7 @@ check_literal_operator_args (const_tree decl,
if (!argtype) if (!argtype)
return false; /* Found ellipsis. */ return false; /* Found ellipsis. */
if (arity > max_arity) if (arity != max_arity)
return false; return false;
return true; return true;
......
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> 2011-11-14 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/sse4_1-floor-sfix-vec.c: New test. * gcc.target/i386/sse4_1-floor-sfix-vec.c: New test.
......
...@@ -4,6 +4,9 @@ ...@@ -4,6 +4,9 @@
class Foo { }; class Foo { };
int
operator"" _Foo(); // { dg-error "has invalid argument list" }
Foo Foo
operator"" _Foo(int *); // { dg-error "has invalid argument list" } operator"" _Foo(int *); // { dg-error "has invalid argument list" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment