re PR c++/51420 ([c++0x] ICE with invalid user-defined literals)

PR c++/51420
	* parser.c (lookup_literal_operator): Check that declaration is an
	overloaded function.

From-SVN: r182083
This commit is contained in:
Ed Smith-Rowland 2011-12-07 15:41:03 +00:00 committed by Jason Merrill
parent 543dfd37ec
commit 7cdd2e6c6e
4 changed files with 20 additions and 1 deletions

View file

@ -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

View file

@ -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))

View file

@ -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

View file

@ -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" }
}