aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/cp/ChangeLog4
-rw-r--r--gcc/cp/cp-tree.h3
-rw-r--r--gcc/cp/decl2.c3
-rw-r--r--gcc/cp/error.c5
-rw-r--r--gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C40
5 files changed, 54 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bed0a5e..4f3f46d 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,9 @@
2015-08-12 Jason Merrill <jason@redhat.com>
+ PR c++/67108
+ * decl2.c (c_parse_final_cleanups): Set at_eof to 2 at end.
+ * error.c (dump_template_bindings): Don't tsubst in that case.
+
PR c++/67161
* error.c (dump_decl) [TEMPLATE_ID_EXPR]: Pass
TFF_NO_OMIT_DEFAULT_TEMPLATE_ARGUMENTS.
diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h
index 78fd4af..ab6b3ec 100644
--- a/gcc/cp/cp-tree.h
+++ b/gcc/cp/cp-tree.h
@@ -4797,7 +4797,8 @@ extern GTY(()) vec<tree, va_gc> *local_classes;
#endif /* !defined(NO_DOLLAR_IN_LABEL) || !defined(NO_DOT_IN_LABEL) */
-/* Nonzero if we're done parsing and into end-of-file activities. */
+/* Nonzero if we're done parsing and into end-of-file activities.
+ Two if we're done with front-end processing. */
extern int at_eof;
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index 068d79c..8e7a453 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -4846,6 +4846,9 @@ c_parse_final_cleanups (void)
timevar_stop (TV_PHASE_DEFERRED);
timevar_start (TV_PHASE_PARSING);
+
+ /* Indicate that we're done with front end processing. */
+ at_eof = 2;
}
/* Perform any post compilation-proper cleanups for the C++ front-end.
diff --git a/gcc/cp/error.c b/gcc/cp/error.c
index ae3e092..faf8744 100644
--- a/gcc/cp/error.c
+++ b/gcc/cp/error.c
@@ -339,6 +339,11 @@ dump_template_bindings (cxx_pretty_printer *pp, tree parms, tree args,
&& !DECL_LANG_SPECIFIC (current_function_decl))
return;
+ /* Don't try to do this once cgraph starts throwing away front-end
+ information. */
+ if (at_eof >= 2)
+ return;
+
FOR_EACH_VEC_SAFE_ELT (typenames, i, t)
{
if (need_semicolon)
diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C
new file mode 100644
index 0000000..d1e4482
--- /dev/null
+++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-targ3.C
@@ -0,0 +1,40 @@
+// PR c++/67108
+// { dg-do compile { target c++11 } }
+
+template < typename, typename > struct is_same;
+template < typename T > struct is_same <T, T >
+{
+ enum
+ {
+ value = true
+ }
+ ;
+ constexpr bool operator () ()
+ {
+ return value;
+ }
+}
+ ;
+template < bool, typename = void >struct enable_if;
+template < typename T > struct enable_if <true, T >
+{
+ typedef T type;
+}
+ ;
+struct A;
+template < typename, typename = void >struct F;
+template < typename X > struct F <X, typename enable_if < is_same < X, A >
+{
+}
+ () >::type >
+{
+ template < typename MakeDependent > F (MakeDependent)
+ {
+ }
+}
+;
+
+int main ()
+{
+ F < A > (1);
+}