]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
Backported from mainline
authorjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2012 10:10:24 +0000 (10:10 +0000)
committerjakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 22 Mar 2012 10:10:24 +0000 (10:10 +0000)
2012-03-14  Jakub Jelinek  <jakub@redhat.com>

PR c++/52521
* parser.c (lookup_literal_operator): Return fn only if
processed all arguments from args vector and argtypes is
void_list_node.

* g++.dg/cpp0x/udlit-args2.C: New test.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@185683 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/parser.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp0x/udlit-args2.C [new file with mode: 0644]

index ea57a4766ae0ceb00babdcad2c360fa3c0ed6d12..806ac9b50c7379d576d0148a7d86d6a62626d481 100644 (file)
@@ -1,3 +1,13 @@
+2012-03-22  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2012-03-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52521
+       * parser.c (lookup_literal_operator): Return fn only if
+       processed all arguments from args vector and argtypes is
+       void_list_node.
+
 2012-03-22  Release Manager
 
        * GCC 4.7.0 released.
index 491f48e0fcc757d042a9aa910656dc91778c35d4..c4b4dd448556a8c6d1b6f0aa86ee08204fd8c7be 100644 (file)
@@ -1,6 +1,6 @@
 /* C++ Parser.
    Copyright (C) 2000, 2001, 2002, 2003, 2004,
-   2005, 2007, 2008, 2009, 2010, 2011  Free Software Foundation, Inc.
+   2005, 2007, 2008, 2009, 2010, 2011, 2012  Free Software Foundation, Inc.
    Written by Mark Mitchell <mark@codesourcery.com>.
 
    This file is part of GCC.
@@ -3581,7 +3581,13 @@ lookup_literal_operator (tree name, VEC(tree,gc) *args)
                                       TREE_TYPE (tparm))))
                found = false;
            }
-         if (found)
+         if (found
+             && ix == VEC_length (tree, args)
+             /* May be this should be sufficient_parms_p instead,
+                depending on how exactly should user-defined literals
+                work in presence of default arguments on the literal
+                operator parameters.  */
+             && argtypes == void_list_node)
            return fn;
        }
     }
index 96226fa35d95321ec5f21c4281e71336de782146..5ee035f3a6ba1b8e82af4f091b03d463a1e2d657 100644 (file)
@@ -1,6 +1,11 @@
 2012-03-22  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2012-03-14  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c++/52521
+       * g++.dg/cpp0x/udlit-args2.C: New test.
+
        2012-03-13  Jakub Jelinek  <jakub@redhat.com>
  
        PR c/52577
diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-args2.C b/gcc/testsuite/g++.dg/cpp0x/udlit-args2.C
new file mode 100644 (file)
index 0000000..1e7190f
--- /dev/null
@@ -0,0 +1,15 @@
+// PR c++/52521
+// { dg-do compile }
+// { dg-options -std=c++11 }
+
+#include <cstddef>
+
+int operator "" _a (const char *);
+int operator "" _a (const char *, std::size_t);
+int a = 123_a;
+int a2 = "abc"_a;
+
+int operator "" _b (const char *, std::size_t);
+int operator "" _b (const char *);
+int b = 123_b;
+int b2 = "abc"_b;