aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Smith-Rowland <3dw4rd@verizon.net>2011-12-07 15:41:03 +0000
committerJason Merrill <jason@gcc.gnu.org>2011-12-07 10:41:03 -0500
commit7cdd2e6c6effc66cf631589102ac6345627022c2 (patch)
tree91eb81a6f211d648ae374281381f4abfde8227b7
parent543dfd37ec2e3efb36f45e9c7608add2cd7e8869 (diff)
downloadgcc-7cdd2e6c6effc66cf631589102ac6345627022c2.zip
gcc-7cdd2e6c6effc66cf631589102ac6345627022c2.tar.gz
gcc-7cdd2e6c6effc66cf631589102ac6345627022c2.tar.bz2
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
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/parser.c2
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/pr51420.C8
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" }
+}