public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* C++ PATCH for c++/89906 (GCC 8 backport)
@ 2019-07-12 20:36 Marek Polacek
  2019-07-19 13:52 ` Marek Polacek
  2019-07-31 18:57 ` Jason Merrill
  0 siblings, 2 replies; 3+ messages in thread
From: Marek Polacek @ 2019-07-12 20:36 UTC (permalink / raw)
  To: GCC Patches, Jason Merrill

In order to fix 89906 in GCC 8, we need to backport 86098.
I think the patch is safe to be backported.

Tested x86_64-linux, ok for 8?

2018-06-12  Jason Merrill  <jason@redhat.com>

	PR c++/86098 - ICE with template placeholder for TTP.
	* typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
	CLASS_PLACEHOLDER_TEMPLATE.

--- gcc/cp/typeck.c
+++ gcc/cp/typeck.c
@@ -1375,6 +1375,11 @@ structural_comptypes (tree t1, tree t2, int strict)
 	 template parameters set, they can't be equal.  */
       if (!comp_template_parms_position (t1, t2))
 	return false;
+      /* If T1 and T2 don't represent the same class template deduction,
+         they aren't equal.  */
+      if (CLASS_PLACEHOLDER_TEMPLATE (t1)
+	  != CLASS_PLACEHOLDER_TEMPLATE (t2))
+	return false;
       /* Constrained 'auto's are distinct from parms that don't have the same
 	 constraints.  */
       if (!equivalent_placeholder_constraints (t1, t2))
--- /dev/null
+++ gcc/testsuite/g++.dg/cpp1z/class-deduction58.C
@@ -0,0 +1,16 @@
+// PR c++/86098
+// { dg-additional-options -std=c++17 }
+
+template <class _Res> class future;
+template <class T> T&& declval();
+
+template<template <class...> class T>
+struct construct_deduced {
+  template <class... AN>
+  using deduced_t = decltype(T{declval<AN>()...});
+  template<class... AN>
+  deduced_t<AN...> operator()(AN&&... an) const;
+};
+
+template<class T>
+future<T> future_from(T singleSender);

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C++ PATCH for c++/89906 (GCC 8 backport)
  2019-07-12 20:36 C++ PATCH for c++/89906 (GCC 8 backport) Marek Polacek
@ 2019-07-19 13:52 ` Marek Polacek
  2019-07-31 18:57 ` Jason Merrill
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2019-07-19 13:52 UTC (permalink / raw)
  To: GCC Patches, Jason Merrill

Ping.

On Fri, Jul 12, 2019 at 04:16:38PM -0400, Marek Polacek wrote:
> In order to fix 89906 in GCC 8, we need to backport 86098.
> I think the patch is safe to be backported.
> 
> Tested x86_64-linux, ok for 8?
> 
> 2018-06-12  Jason Merrill  <jason@redhat.com>
> 
> 	PR c++/86098 - ICE with template placeholder for TTP.
> 	* typeck.c (structural_comptypes) [TEMPLATE_TYPE_PARM]: Check
> 	CLASS_PLACEHOLDER_TEMPLATE.
> 
> --- gcc/cp/typeck.c
> +++ gcc/cp/typeck.c
> @@ -1375,6 +1375,11 @@ structural_comptypes (tree t1, tree t2, int strict)
>  	 template parameters set, they can't be equal.  */
>        if (!comp_template_parms_position (t1, t2))
>  	return false;
> +      /* If T1 and T2 don't represent the same class template deduction,
> +         they aren't equal.  */
> +      if (CLASS_PLACEHOLDER_TEMPLATE (t1)
> +	  != CLASS_PLACEHOLDER_TEMPLATE (t2))
> +	return false;
>        /* Constrained 'auto's are distinct from parms that don't have the same
>  	 constraints.  */
>        if (!equivalent_placeholder_constraints (t1, t2))
> --- /dev/null
> +++ gcc/testsuite/g++.dg/cpp1z/class-deduction58.C
> @@ -0,0 +1,16 @@
> +// PR c++/86098
> +// { dg-additional-options -std=c++17 }
> +
> +template <class _Res> class future;
> +template <class T> T&& declval();
> +
> +template<template <class...> class T>
> +struct construct_deduced {
> +  template <class... AN>
> +  using deduced_t = decltype(T{declval<AN>()...});
> +  template<class... AN>
> +  deduced_t<AN...> operator()(AN&&... an) const;
> +};
> +
> +template<class T>
> +future<T> future_from(T singleSender);

Marek

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: C++ PATCH for c++/89906 (GCC 8 backport)
  2019-07-12 20:36 C++ PATCH for c++/89906 (GCC 8 backport) Marek Polacek
  2019-07-19 13:52 ` Marek Polacek
@ 2019-07-31 18:57 ` Jason Merrill
  1 sibling, 0 replies; 3+ messages in thread
From: Jason Merrill @ 2019-07-31 18:57 UTC (permalink / raw)
  To: Marek Polacek, GCC Patches

On 7/12/19 4:16 PM, Marek Polacek wrote:
> In order to fix 89906 in GCC 8, we need to backport 86098.
> I think the patch is safe to be backported.
> 
> Tested x86_64-linux, ok for 8?

OK.

Jason

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-07-31 18:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-12 20:36 C++ PATCH for c++/89906 (GCC 8 backport) Marek Polacek
2019-07-19 13:52 ` Marek Polacek
2019-07-31 18:57 ` Jason Merrill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).