diff options
author | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-14 08:30:23 +0000 |
---|---|---|
committer | jakub <jakub@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-03-14 08:30:23 +0000 |
commit | 66468a32b66242b2af28ac711cbffaf1c62aff56 (patch) | |
tree | b335316081da5b7753fee1c76deede58c90fae4b | |
parent | 496be70f95f3469e780523b92b081ce78e2a7214 (diff) | |
download | gcc-66468a32b66242b2af28ac711cbffaf1c62aff56.tar.gz |
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/trunk@185375 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r-- | gcc/cp/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/cp/parser.c | 10 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/udlit-args2.C | 15 |
4 files changed, 35 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 6ef5545fbf5..7f3acbd6c8b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,10 @@ +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-01-30 Dodji Seketeli <dodji@redhat.com> PR c++/51641 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index c6bd2906203..b3c87a8047d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -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; } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f8f7a1d2f7..11c8e8fa40a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-03-14 Jakub Jelinek <jakub@redhat.com> + + PR c++/52521 + * g++.dg/cpp0x/udlit-args2.C: New test. + 2012-03-13 Oleg Endo <olegendo@gcc.gnu.org> PR target/48596 diff --git a/gcc/testsuite/g++.dg/cpp0x/udlit-args2.C b/gcc/testsuite/g++.dg/cpp0x/udlit-args2.C new file mode 100644 index 00000000000..1e7190fc8f7 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/udlit-args2.C @@ -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; |