diff options
author | Ed Smith-Rowland <3dw4rd@verizon.net> | 2011-11-14 20:05:12 +0000 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-11-14 15:05:12 -0500 |
commit | d2027d2a83aedcebbcb0f70c59027712c134f3b6 (patch) | |
tree | b100efadc50bdae9660a11be08c3a1185bc733c5 | |
parent | eab880cf621b82e4f38aed74b58d2bd76f89c46a (diff) | |
download | gcc-d2027d2a83aedcebbcb0f70c59027712c134f3b6.zip gcc-d2027d2a83aedcebbcb0f70c59027712c134f3b6.tar.gz gcc-d2027d2a83aedcebbcb0f70c59027712c134f3b6.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/typeck.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C | 3 |
4 files changed, 18 insertions, 4 deletions
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 <fabien@gcc.gnu.org> 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 <ubizjak@gmail.com> * 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" } |