public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints
@ 2023-07-03 16:36 corentinjabot at gmail dot com
  2023-07-03 20:06 ` [Bug c++/110535] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: corentinjabot at gmail dot com @ 2023-07-03 16:36 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110535
           Summary: Internal error when performing a surrogate call with
                    unsatisfied constraints
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: corentinjabot at gmail dot com
  Target Milestone: ---

Consider 

   int f1(int);

   template <auto N>
   struct A {
    using F = int(int);
    operator F*() requires N { return f1; }
   };

   int i = A<true>{}(0);  // Fine
   int j = A<false>{}(0); // Crash


This affects tip of trunk on CE https://godbolt.org/z/7vahavxv6

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

* [Bug c++/110535] Internal error when performing a surrogate call with unsatisfied constraints
  2023-07-03 16:36 [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints corentinjabot at gmail dot com
@ 2023-07-03 20:06 ` pinskia at gcc dot gnu.org
  2023-07-18 13:23 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-03 20:06 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2023-07-03
      Known to fail|                            |8.1.0, 9.3.0
           Keywords|                            |ice-on-invalid-code
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.

In GCC 7, GCC didn't crash (with -std=c++17 -fconcepts) but gave a wrong error
message:
<source>:11:24: error: no match for call to '(A<false>) (int)'
    int j = A<false>{}(0); // Crash
                        ^
<source>:11:24: note: candidate: int (*)(int) <conversion>
<source>:11:24: note:   candidate expects 1 argument, 2 provided

The crash started in GCC 8.

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

* [Bug c++/110535] Internal error when performing a surrogate call with unsatisfied constraints
  2023-07-03 16:36 [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints corentinjabot at gmail dot com
  2023-07-03 20:06 ` [Bug c++/110535] " pinskia at gcc dot gnu.org
@ 2023-07-18 13:23 ` cvs-commit at gcc dot gnu.org
  2023-07-18 13:26 ` ppalka at gcc dot gnu.org
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-18 13:23 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 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:1e0f37df1b12cd91a6dbb523f5c722f9a961edaa

commit r14-2618-g1e0f37df1b12cd91a6dbb523f5c722f9a961edaa
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jul 18 09:21:40 2023 -0400

    c++: constrained surrogate call functions [PR110535]

    We weren't checking constraints on pointer/reference-to-function conversion
    functions during overload resolution, which caused us to ICE on the first
    testcase and reject the second testcase.

            PR c++/110535

    gcc/cp/ChangeLog:

            * call.cc (add_conv_candidate): Check constraints.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-surrogate1.C: New test.
            * g++.dg/cpp2a/concepts-surrogate2.C: New test.

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

* [Bug c++/110535] Internal error when performing a surrogate call with unsatisfied constraints
  2023-07-03 16:36 [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints corentinjabot at gmail dot com
  2023-07-03 20:06 ` [Bug c++/110535] " pinskia at gcc dot gnu.org
  2023-07-18 13:23 ` cvs-commit at gcc dot gnu.org
@ 2023-07-18 13:26 ` ppalka at gcc dot gnu.org
  2023-07-19 20:02 ` cvs-commit at gcc dot gnu.org
  2023-07-19 20:03 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-18 13:26 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Fixed on trunk so far.

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

* [Bug c++/110535] Internal error when performing a surrogate call with unsatisfied constraints
  2023-07-03 16:36 [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints corentinjabot at gmail dot com
                   ` (2 preceding siblings ...)
  2023-07-18 13:26 ` ppalka at gcc dot gnu.org
@ 2023-07-19 20:02 ` cvs-commit at gcc dot gnu.org
  2023-07-19 20:03 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-19 20:02 UTC (permalink / raw)
  To: gcc-bugs

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

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

https://gcc.gnu.org/g:92f6240baf80f998ca6c1408c3ee09d5d2ae68d7

commit r13-7592-g92f6240baf80f998ca6c1408c3ee09d5d2ae68d7
Author: Patrick Palka <ppalka@redhat.com>
Date:   Tue Jul 18 09:21:40 2023 -0400

    c++: constrained surrogate call functions [PR110535]

    We weren't checking constraints on pointer/reference-to-function conversion
    functions during overload resolution, which caused us to ICE on the first
    testcase and reject the second testcase.

            PR c++/110535

    gcc/cp/ChangeLog:

            * call.cc (add_conv_candidate): Check constraints.

    gcc/testsuite/ChangeLog:

            * g++.dg/cpp2a/concepts-surrogate1.C: New test.
            * g++.dg/cpp2a/concepts-surrogate2.C: New test.

    (cherry picked from commit 1e0f37df1b12cd91a6dbb523f5c722f9a961edaa)

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

* [Bug c++/110535] Internal error when performing a surrogate call with unsatisfied constraints
  2023-07-03 16:36 [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints corentinjabot at gmail dot com
                   ` (3 preceding siblings ...)
  2023-07-19 20:02 ` cvs-commit at gcc dot gnu.org
@ 2023-07-19 20:03 ` ppalka at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-07-19 20:03 UTC (permalink / raw)
  To: gcc-bugs

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

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 for GCC 13.2, thanks for the report.

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

end of thread, other threads:[~2023-07-19 20:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-03 16:36 [Bug c++/110535] New: Internal error when performing a surrogate call with unsatisfied constraints corentinjabot at gmail dot com
2023-07-03 20:06 ` [Bug c++/110535] " pinskia at gcc dot gnu.org
2023-07-18 13:23 ` cvs-commit at gcc dot gnu.org
2023-07-18 13:26 ` ppalka at gcc dot gnu.org
2023-07-19 20:02 ` cvs-commit at gcc dot gnu.org
2023-07-19 20:03 ` ppalka at gcc dot gnu.org

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