public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP
@ 2021-03-03 17:48 johelegp at gmail dot com
  2021-03-03 19:53 ` [Bug c++/99365] [11 Regression] " mpolacek at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: johelegp at gmail dot com @ 2021-03-03 17:48 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

            Bug ID: 99365
           Summary: ICE on partial specialization with constrained
                    placeholder NTTP
           Product: gcc
           Version: 11.0
               URL: https://godbolt.org/z/nxTEaW
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/nxTEaW.
```C++
template<class>concept C=true;
template<C auto>struct A{};
template<C auto V>requires true struct A<V>{};
```
I think CE recompiles GCC trunk daily, and this was working yesterday.

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
@ 2021-03-03 19:53 ` mpolacek at gcc dot gnu.org
  2021-03-03 21:17 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2021-03-03 19:53 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

Marek Polacek <mpolacek at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE on partial              |[11 Regression] ICE on
                   |specialization with         |partial specialization with
                   |constrained placeholder     |constrained placeholder
                   |NTTP                        |NTTP
     Ever confirmed|0                           |1
           Priority|P3                          |P1
   Last reconfirmed|                            |2021-03-03
             Status|UNCONFIRMED                 |NEW
                 CC|                            |mpolacek at gcc dot gnu.org,
                   |                            |ppalka at gcc dot gnu.org
   Target Milestone|---                         |11.0

--- Comment #1 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Started with r11-7454.

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
  2021-03-03 19:53 ` [Bug c++/99365] [11 Regression] " mpolacek at gcc dot gnu.org
@ 2021-03-03 21:17 ` ppalka at gcc dot gnu.org
  2021-03-03 22:54 ` ppalka at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-03-03 21:17 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |ppalka at gcc dot gnu.org

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
  2021-03-03 19:53 ` [Bug c++/99365] [11 Regression] " mpolacek at gcc dot gnu.org
  2021-03-03 21:17 ` ppalka at gcc dot gnu.org
@ 2021-03-03 22:54 ` ppalka at gcc dot gnu.org
  2021-03-03 22:55 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-03-03 22:54 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 99366 has been marked as a duplicate of this bug. ***

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
                   ` (2 preceding siblings ...)
  2021-03-03 22:54 ` ppalka at gcc dot gnu.org
@ 2021-03-03 22:55 ` ppalka at gcc dot gnu.org
  2021-03-06  5:08 ` cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-03-03 22:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Another variant from PR99366 which we reject rather than ICE on:

(In reply to Johel Ernesto Guerrero Peña from comment #0)
> See https://godbolt.org/z/ETjYfP.
> ```C++
> template<class>concept C=true;
> template<class,C auto>struct A{};
> template<class T,C auto V>requires true struct A<T,V>{};
> ```
> I think CE recompiles GCC trunk daily, and this was working yesterday.
> Must be related to Bug 99365.

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
                   ` (3 preceding siblings ...)
  2021-03-03 22:55 ` ppalka at gcc dot gnu.org
@ 2021-03-06  5:08 ` cvs-commit at gcc dot gnu.org
  2021-03-06 15:35 ` ppalka at gcc dot gnu.org
  2021-03-07 17:47 ` johelegp at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-06  5:08 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

--- Comment #4 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Patrick Palka <ppalka@gcc.gnu.org>:

https://gcc.gnu.org/g:b49d23f3e238c08bdbc5b892b2ed0a57b5f5caf9

commit r11-7540-gb49d23f3e238c08bdbc5b892b2ed0a57b5f5caf9
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Mar 6 00:07:35 2021 -0500

    c++: adc_unify deduction with constrained auto [PR99365]

    My recent r11-7454 changed the way do_auto_deduction handles constrained
    placeholders during template argument deduction (context == adc_unify)
    when processing_template_decl != 0.  Before the patch, we would just
    ignore the constraints on the placeholder, and return the deduced type.
    After the patch, we now punt and return the original placeholder type

    While this change fixed instances where we'd prematurely resolve a
    constrained placeholder return or variable type with non-dependent
    initializer at template parse time (such as PR96444), it broke the
    adc_unify callers that rely on the previous behavior.

    This patch restores the previous behavior during adc_unify deduction
    while retaining the new behavior only during adc_variable_type or
    adc_return_type deduction.

    We additionally now need to pass the outer template arguments to
    do_auto_deduction during unify, for sake of constraint checking.
    But we want to avoid substituting these outer arguments into type
    when the caller has already done so, so this patch adds a
    TEMPLATE_TYPE_LEVEL check to do_auto_deduction to that effect.

    This above is enough to fix partial specialization of non-nested
    templates with constrained 'auto' template parameters, but it doesn't
    fix the nested template case, ultimately because
    most_specialized_partial_spec passes only the innermost template
    arguments to get_partial_spec_bindings, and so outer_targs during
    do_auto_deduction (called from unify) contains only the innermost
    template arguments, and this breaks satisfaction.  Fixing this properly
    is perhaps too risky at this stage, so this patch adds a hack to
    do_auto_deduction to compensate for callers that don't supply all outer
    template arguments.  The goal of this hack is to ensure placeholder type
    constraint checking continues to work whenever it worked before
    r11-7454, namely whenever the constraint is non-dependent.

    Finally, this patch allows do_auto_deduction to resolve a constrained
    placeholder type ahead of time (at template parse time), as long as the
    constraint is non-dependent.

    gcc/cp/ChangeLog:

            PR c++/99365
            * pt.c (unify) <case TEMPLATE_TYPE_PARM>: Pass targs as
            outer_targs to do_auto_deduction.
            (placeholder_type_constraint_dependent_p): Define.
            (do_auto_deduction): When processing_template_decl != 0
            and context is adc_unify and we have constraints, pretend the
            constraints are satisfied instead of punting.  Otherwise don't
            punt unless placeholder_type_constraint_dependent_p holds.
            Add some clarifying sanity checks.  Add a hack to add missing
            outermost template levels to outer_args before checking
            satisfaction.  Don't substitute outer_targs into type if it's
            already been done.

    gcc/testsuite/ChangeLog:

            PR c++/99365
            * g++.dg/cpp2a/concepts-partial-spec9.C: New test.
            * g++.dg/cpp2a/concepts-placeholder4.C: New test.

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
                   ` (4 preceding siblings ...)
  2021-03-06  5:08 ` cvs-commit at gcc dot gnu.org
@ 2021-03-06 15:35 ` ppalka at gcc dot gnu.org
  2021-03-07 17:47 ` johelegp at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-03-06 15:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

Patrick Palka <ppalka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed.

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

* [Bug c++/99365] [11 Regression] ICE on partial specialization with constrained placeholder NTTP
  2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
                   ` (5 preceding siblings ...)
  2021-03-06 15:35 ` ppalka at gcc dot gnu.org
@ 2021-03-07 17:47 ` johelegp at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: johelegp at gmail dot com @ 2021-03-07 17:47 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99365

--- Comment #6 from Johel Ernesto Guerrero Peña <johelegp at gmail dot com> ---
Thank you. Can confirm it's working for my use case.

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

end of thread, other threads:[~2021-03-07 17:47 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-03 17:48 [Bug c++/99365] New: ICE on partial specialization with constrained placeholder NTTP johelegp at gmail dot com
2021-03-03 19:53 ` [Bug c++/99365] [11 Regression] " mpolacek at gcc dot gnu.org
2021-03-03 21:17 ` ppalka at gcc dot gnu.org
2021-03-03 22:54 ` ppalka at gcc dot gnu.org
2021-03-03 22:55 ` ppalka at gcc dot gnu.org
2021-03-06  5:08 ` cvs-commit at gcc dot gnu.org
2021-03-06 15:35 ` ppalka at gcc dot gnu.org
2021-03-07 17:47 ` johelegp at gmail dot com

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).