re PR c++/83817 (internal compiler error: tree check: expected call_expr, have aggr_i...
authorJakub Jelinek <jakub@redhat.com>
Tue, 16 Jan 2018 08:44:48 +0000 (09:44 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 16 Jan 2018 08:44:48 +0000 (09:44 +0100)
PR c++/83817
* pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
instead of CALL_FROM_THUNK_P.

* g++.dg/cpp1y/pr83817.C: New test.

From-SVN: r256726

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/cpp1y/pr83817.C [new file with mode: 0644]

index 2371a54d0041cfff10f60de7b5a1fe2eb0f51207..a0119e14640180d0a9dd401b3ca9da20f45bed43 100644 (file)
@@ -1,5 +1,10 @@
 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/83817
+       * pt.c (tsubst_copy_and_build) <case CALL_EXPR>: If function
+       is AGGR_INIT_EXPR rather than CALL_EXPR, set AGGR_INIT_FROM_THUNK_P
+       instead of CALL_FROM_THUNK_P.
+
        PR c++/83825
        * name-lookup.c (member_vec_dedup): Return early if len is 0.
        (resort_type_member_vec, set_class_bindings,
index bb5908fb85319203e3f33677454a6b41d63e628a..322408d92ec286a9a19de5dd28d2725ac0e491fb 100644 (file)
@@ -17819,7 +17819,10 @@ tsubst_copy_and_build (tree t,
                CALL_EXPR_REVERSE_ARGS (function) = rev;
                if (thk)
                  {
-                   CALL_FROM_THUNK_P (function) = true;
+                   if (TREE_CODE (function) == CALL_EXPR)
+                     CALL_FROM_THUNK_P (function) = true;
+                   else
+                     AGGR_INIT_FROM_THUNK_P (function) = true;
                    /* The thunk location is not interesting.  */
                    SET_EXPR_LOCATION (function, UNKNOWN_LOCATION);
                  }
index 2a44bb180808204207f7784fbdc59bd3c7c3cb14..7bbeafafa34608cf3a5436da9c7768a3aad7743f 100644 (file)
@@ -1,5 +1,8 @@
 2018-01-16  Jakub Jelinek  <jakub@redhat.com>
 
+       PR c++/83817
+       * g++.dg/cpp1y/pr83817.C: New test.
+
        PR c++/83825
        * g++.dg/template/pr83825.C: New test.
 
diff --git a/gcc/testsuite/g++.dg/cpp1y/pr83817.C b/gcc/testsuite/g++.dg/cpp1y/pr83817.C
new file mode 100644 (file)
index 0000000..9a69cbb
--- /dev/null
@@ -0,0 +1,17 @@
+// PR c++/83817
+// { dg-do compile { target c++14 } }
+
+struct A;
+struct B { template <typename> using C = A; };
+struct D : B { struct F { typedef C<char> E; }; };
+struct G {
+  struct I { I (D, A &); } h;
+  D::F::E &k ();
+  D j;
+  G (G &&) : h (j, k ()) {}
+};
+struct N { G l; };
+typedef N (*M)(N &);
+struct H { const char *o; M s; };
+N foo (N &);
+H r { "", [](auto &x) { return foo (x); }};