[Bug c++/99683] Deduction failure when using CTAD of CNTTP inside a deduction guide
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99683 Patrick Palka changed: What|Removed |Added Status|NEW |RESOLVED Target Milestone|--- |11.2 Resolution|--- |FIXED --- Comment #5 from Patrick Palka --- Fixed for GCC 11.2 and 12.
[Bug c++/99683] Deduction failure when using CTAD of CNTTP inside a deduction guide
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99683 --- Comment #4 from CVS Commits --- The releases/gcc-11 branch has been updated by Patrick Palka : https://gcc.gnu.org/g:9532344edcf77c7c7b0fa5da31c1b9dd2850288e commit r11-8309-g9532344edcf77c7c7b0fa5da31c1b9dd2850288e Author: Patrick Palka Date: Sat Apr 24 00:14:29 2021 -0400 c++: do_class_deduction and dependent init [PR93383] Here we're crashing during CTAD with a dependent initializer (performed from convert_template_argument) because one of the initializer's elements has an empty TREE_TYPE, which ends up making resolve_args unhappy. Besides the case where we're initializing one template placeholder from another, which is already specifically handled earlier in do_class_deduction, it seems we can't in general correctly resolve a template placeholder using a dependent initializer, so this patch makes the function just punt until instantiation time instead. gcc/cp/ChangeLog: PR c++/89565 PR c++/93383 PR c++/95291 PR c++/99200 PR c++/99683 * pt.c (do_class_deduction): Punt if the initializer is type-dependent. gcc/testsuite/ChangeLog: PR c++/89565 PR c++/93383 PR c++/95291 PR c++/99200 PR c++/99683 * g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive. * g++.dg/cpp2a/nontype-class45.C: New test. * g++.dg/cpp2a/nontype-class46.C: New test. * g++.dg/cpp2a/nontype-class47.C: New test. * g++.dg/cpp2a/nontype-class48.C: New test. (cherry picked from commit bcd77b7b9f35bd5b559ed593c3b3e346c1e6f364)
[Bug c++/99683] Deduction failure when using CTAD of CNTTP inside a deduction guide
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99683 --- Comment #3 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:bcd77b7b9f35bd5b559ed593c3b3e346c1e6f364 commit r12-100-gbcd77b7b9f35bd5b559ed593c3b3e346c1e6f364 Author: Patrick Palka Date: Sat Apr 24 00:14:29 2021 -0400 c++: do_class_deduction and dependent init [PR93383] Here we're crashing during CTAD with a dependent initializer (performed from convert_template_argument) because one of the initializer's elements has an empty TREE_TYPE, which ends up making resolve_args unhappy. Besides the case where we're initializing one template placeholder from another, which is already specifically handled earlier in do_class_deduction, it seems we can't in general correctly resolve a template placeholder using a dependent initializer, so this patch makes the function just punt until instantiation time instead. gcc/cp/ChangeLog: PR c++/89565 PR c++/93383 PR c++/95291 PR c++/99200 PR c++/99683 * pt.c (do_class_deduction): Punt if the initializer is type-dependent. gcc/testsuite/ChangeLog: PR c++/89565 PR c++/93383 PR c++/95291 PR c++/99200 PR c++/99683 * g++.dg/cpp2a/nontype-class39.C: Remove dg-ice directive. * g++.dg/cpp2a/nontype-class45.C: New test. * g++.dg/cpp2a/nontype-class46.C: New test. * g++.dg/cpp2a/nontype-class47.C: New test. * g++.dg/cpp2a/nontype-class48.C: New test.
[Bug c++/99683] Deduction failure when using CTAD of CNTTP inside a deduction guide
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99683 Patrick Palka changed: What|Removed |Added See Also||https://gcc.gnu.org/bugzill ||a/show_bug.cgi?id=93383 Status|UNCONFIRMED |NEW CC||ppalka at gcc dot gnu.org Ever confirmed|0 |1 Last reconfirmed||2021-04-15 --- Comment #2 from Patrick Palka --- Thanks for the reduced testcases, confirmed. Closely related to PR93383 I think.
[Bug c++/99683] Deduction failure when using CTAD of CNTTP inside a deduction guide
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99683 --- Comment #1 from Omer Rosler --- It seems that Reduced: template struct A { constexpr A(int) {} }; A(int) -> A; template //template works fine struct B { template B(T); }; template B(T) -> B; //see below int main() { B t(42); } specifying A explicitly also works, it's the deduction that triggers the bug If the initializer of `A` is not dependent on the template parameter of the guide (i.e `T`) than the bug isn't showing