]> gcc.gnu.org Git - gcc.git/commitdiff
re PR c++/51420 ([c++0x] ICE with invalid user-defined literals)
authorEd Smith-Rowland <3dw4rd@verizon.net>
Wed, 7 Dec 2011 15:41:03 +0000 (15:41 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 7 Dec 2011 15:41:03 +0000 (10:41 -0500)
PR c++/51420
* parser.c (lookup_literal_operator): Check that declaration is an
overloaded function.

From-SVN: r182083

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

index defc0a5eb44b2591875c576fe5240724a5741664..71a707e80bb5320cc31cf4640b48e577934cf730 100644 (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
index daf2ded45dc26976306f1e337b6d9f0501323b85..17a607d4f3d401a3a0af31872fb43532f818b852 100644 (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))
index 857677ba37999059ac45a30fe190ff042a2a054e..5ecacdd125a61c70ec3ce7e31d6e7ddbe819f79e 100644 (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
diff --git a/gcc/testsuite/g++.dg/cpp0x/pr51420.C b/gcc/testsuite/g++.dg/cpp0x/pr51420.C
new file mode 100644 (file)
index 0000000..aec8cb1
--- /dev/null
@@ -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" }
+}
This page took 0.110482 seconds and 5 git commands to generate.