diff options
-rw-r--r-- | gcc/cp/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/cp/parser.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/pr51420.C | 8 |
4 files changed, 20 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index defc0a5..71a707e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2011-12-07 Ed Smith-Rowland <3dw4rd@verizon.net> + + PR c++/51420 + * parser.c (lookup_literal_operator): Check that declaration is an + overloaded function. + 2011-12-06 Jakub Jelinek <jakub@redhat.com> PR c++/51430 diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c index daf2ded..17a607d 100644 --- a/gcc/cp/parser.c +++ b/gcc/cp/parser.c @@ -3554,7 +3554,7 @@ lookup_literal_operator (tree name, VEC(tree,gc) *args) { tree decl, fns; decl = lookup_name (name); - if (!decl || decl == error_mark_node) + if (!decl || !is_overloaded_fn (decl)) return error_mark_node; for (fns = decl; fns; fns = OVL_NEXT (fns)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 857677b..5ecacdd 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2011-12-07 Ed Smith-Rowland <3dw4rd@verizon.net> + + PR c++/51420 + * g++.dg/cpp0x/pr51420.C: New. + 2011-12-07 Richard Guenther <rguenther@suse.de> PR lto/48100 diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51420.C b/gcc/testsuite/g++.dg/cpp0x/pr51420.C new file mode 100644 index 0000000..aec8cb1 --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/pr51420.C @@ -0,0 +1,8 @@ +// { dg-options "-std=c++11" } + +void +foo() +{ + float x = operator"" _F(); // { dg-error "was not declared in this scope" } + float y = 0_F; // { dg-error "unable to find numeric literal operator" } +} |