re PR c++/51107 ([C++11] Accepts invalid literal operator with void argument list.)
authorEd Smith-Rowland <3dw4rd@verizon.net>
Mon, 14 Nov 2011 20:05:12 +0000 (20:05 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 14 Nov 2011 20:05:12 +0000 (15:05 -0500)
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
gcc/cp/typeck.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/udlit-args-neg.C

index e9a7330db63e19e6f7fcb08142b10a01e5f75081..cf91451775c1678d776a004d7c56d769ec04a0ff 100644 (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
index f08877c5b612059a11f061efd5f854f1da81e161..b8d4c10c8ca29687dcee1ba56b95c9ec2151b97a 100644 (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;
index e371383f0cc4eb7ef4c6724350b33b48e7222566..b30ee641923a4ac8dbbdbe8b595207ffe871ed2f 100644 (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.
index cb924a249bf612627b6a79723758cbe966f3b883..df7b7281c3d9b3381ef002772f16044cc689a57c 100644 (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" }