Hi,
in order to avoid this error recovery issue I think we want to check the
return value of grok_ctor_properties, as we do in decl.c, for its only
other use. Tested x86_64-linux.
Thanks, Paolo.
//////////////////
/cp
2017-05-08 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/80186
* pt.c (tsubst_decl): Early return error_mark_node if
grok_ctor_properties returns false.
/testsuite
2017-05-08 Paolo Carlini <paolo.carl...@oracle.com>
PR c++/80186
* g++.dg/template/crash126.C: New.
Index: cp/pt.c
===================================================================
--- cp/pt.c (revision 247733)
+++ cp/pt.c (working copy)
@@ -12407,8 +12407,8 @@ tsubst_decl (tree t, tree args, tsubst_flags_t com
if (DECL_CONSTRUCTOR_P (r) || DECL_DESTRUCTOR_P (r))
{
maybe_retrofit_in_chrg (r);
- if (DECL_CONSTRUCTOR_P (r))
- grok_ctor_properties (ctx, r);
+ if (DECL_CONSTRUCTOR_P (r) && !grok_ctor_properties (ctx, r))
+ RETURN (error_mark_node);
/* If this is an instantiation of a member template, clone it.
If it isn't, that'll be handled by
clone_constructors_and_destructors. */
Index: testsuite/g++.dg/template/crash126.C
===================================================================
--- testsuite/g++.dg/template/crash126.C (revision 0)
+++ testsuite/g++.dg/template/crash126.C (working copy)
@@ -0,0 +1,13 @@
+// PR c++/80186
+
+template < class T, class > struct A
+{
+ A ();
+ A (A &);
+ A (A < T, T >); // { dg-error "invalid constructor" }
+};
+
+void f ()
+{
+ A < int, int > (A < int, int >()); // { dg-error "cannot bind" }
+}