This time with patch. gcc/testsuite:
2011-12-06 Ed Smith-Rowland <3dw...@verizon.net> PR c++/51420 * g++.dg/cpp0x/pr51420.C: New. gcc/cp: 2011-12-06 Ed Smith-Rowland <3dw...@verizon.net> PR c++/51420 * parser.c (lookup_literal_operator): Check that current overload is function_type.
Index: gcc/testsuite/g++.dg/cpp0x/pr51420.C =================================================================== --- gcc/testsuite/g++.dg/cpp0x/pr51420.C (revision 0) +++ gcc/testsuite/g++.dg/cpp0x/pr51420.C (revision 0) @@ -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" } +} Index: gcc/cp/parser.c =================================================================== --- gcc/cp/parser.c (revision 182038) +++ gcc/cp/parser.c (working copy) @@ -3563,6 +3563,8 @@ bool found = true; tree fn = OVL_CURRENT (fns); tree argtypes = NULL_TREE; + if (TREE_CODE (TREE_TYPE (fn)) != FUNCTION_TYPE) + return error_mark_node; argtypes = TYPE_ARG_TYPES (TREE_TYPE (fn)); if (argtypes != NULL_TREE) {