aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2011-07-25 01:03:50 -0400
committerJason Merrill <jason@gcc.gnu.org>2011-07-25 01:03:50 -0400
commit3bb4eb1cb3f3d41d82a46f05daba03c515be3813 (patch)
treefffac9b4210e2d4d29b8ad14509098ec0d21f123 /gcc
parent149e741d2c9a871c5ad7a9c6a02b340e224c3f1e (diff)
downloadgcc-3bb4eb1cb3f3d41d82a46f05daba03c515be3813.zip
gcc-3bb4eb1cb3f3d41d82a46f05daba03c515be3813.tar.gz
gcc-3bb4eb1cb3f3d41d82a46f05daba03c515be3813.tar.bz2
re PR c++/49823 ([C++0x] ICE on decltype(expr)::type with template)
PR c++/49823 * parser.c (cp_parser_qualifying_entity): Handle templates. From-SVN: r176732
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/parser.c4
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/decltype21.C16
4 files changed, 28 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 284224f..a0f1f22 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2011-07-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/49823
+ * parser.c (cp_parser_qualifying_entity): Handle templates.
+
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793
diff --git a/gcc/cp/parser.c b/gcc/cp/parser.c
index dc54dc2..4e7d905 100644
--- a/gcc/cp/parser.c
+++ b/gcc/cp/parser.c
@@ -4638,7 +4638,9 @@ cp_parser_qualifying_entity (cp_parser *parser,
cp_parser_simulate_error (parser);
return error_mark_node;
}
- return TYPE_NAME (scope);
+ if (TYPE_NAME (scope))
+ scope = TYPE_NAME (scope);
+ return scope;
}
/* Before we try to parse the class-name, we must save away the
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 1d0d089..9eb5de6 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2011-07-23 Jason Merrill <jason@redhat.com>
+
+ * g++.dg/cpp0x/decltype21.C: Add 49823 examples.
+
2011-07-22 Jason Merrill <jason@redhat.com>
PR c++/49793
diff --git a/gcc/testsuite/g++.dg/cpp0x/decltype21.C b/gcc/testsuite/g++.dg/cpp0x/decltype21.C
index ee73bfb..7337256 100644
--- a/gcc/testsuite/g++.dg/cpp0x/decltype21.C
+++ b/gcc/testsuite/g++.dg/cpp0x/decltype21.C
@@ -10,6 +10,22 @@ struct c : decltype(make<p>()) {};
decltype(make<p>())::t t;
+// PR c++/49823
+
+template < typename T >
+auto f( const T &x )
+ -> typename decltype( x )::type; // ICE on here
+
+template < typename T >
+typename decltype( T{} )::type // ICE on here
+f( T );
+
+template < typename T >
+void f( T x )
+{ typename decltype( x )::type t; } // ICE on here
+
+// Negative tests
+
int f();
decltype(f())::t t2; // { dg-error "not a class" }