From d2027d2a83aedcebbcb0f70c59027712c134f3b6 Mon Sep 17 00:00:00 2001 From: Ed Smith-Rowland <3dw4rd@verizon.net> Date: Mon, 14 Nov 2011 20:05:12 +0000 Subject: 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 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/typeck.c | 7 +++---- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C | 3 +++ 4 files changed, 18 insertions(+), 4 deletions(-) (limited to 'gcc') diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index e9a7330..cf91451 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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 PR c++/6936 diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index f08877c..b8d4c10 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e371383..b30ee64 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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 * gcc.target/i386/sse4_1-floor-sfix-vec.c: New test. diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C b/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C index cb924a2..df7b728 100644 --- a/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C @@ -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" } -- cgit v1.1