Just like in make_constrained_auto, we need to defer setting TYPE_CANONICAL
until we've set fields that will affect structural_comptypes.
* pt.c (make_template_placeholder): Set TYPE_CANONICAL after
CLASS_PLACEHOLDER_TEMPLATE.
From-SVN: r269080
+2019-02-21 Jason Merrill <jason@redhat.com>
+
+ PR c++/88419 - C++17 ICE with class template arg deduction.
+ * pt.c (make_template_placeholder): Set TYPE_CANONICAL after
+ CLASS_PLACEHOLDER_TEMPLATE.
+
2019-02-21 Jakub Jelinek <jakub@redhat.com>
PR c++/89285
tree
make_template_placeholder (tree tmpl)
{
- tree t = make_auto_1 (auto_identifier, true);
+ tree t = make_auto_1 (auto_identifier, false);
CLASS_PLACEHOLDER_TEMPLATE (t) = tmpl;
+ /* Our canonical type depends on the placeholder. */
+ TYPE_CANONICAL (t) = canonical_type_parameter (t);
return t;
}
--- /dev/null
+// PR c++/88419
+// { dg-do compile { target c++17 } }
+
+template<class> struct ref_view {
+ template<class T> ref_view(T&&);
+};
+
+template<class R> ref_view(R&) -> ref_view<R>;
+
+struct ref_fn {
+ template<class R> auto operator()(R r) const
+ noexcept(noexcept(ref_view{r}));
+};
+
+template<class R> struct indirect_view {
+ indirect_view(R);
+};
+
+struct indirect_fn {
+ template<class R> auto operator()(R r) const
+ noexcept(noexcept(indirect_view{r}));
+};