public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/96531] New: ICE for concepts here.
@ 2020-08-07 22:38 euloanty at live dot com
  2020-08-12 12:57 ` [Bug c++/96531] [10/11 Regression] " ppalka at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: euloanty at live dot com @ 2020-08-07 22:38 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 96531
           Summary: ICE for concepts here.
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: euloanty at live dot com
  Target Milestone: ---

#include<variant>
#include<concepts>

template<typename ... Args> struct pack {};
template<typename ... Args> struct uv : std::false_type {};
template<typename ... Args> struct uv<std::variant<Args...>> {
    using type = pack<Args...>;
};

template <typename T, typename ... Args>
concept is_any_of_impl_4 = requires(pack<Args>) {
    requires (std::same_as<T, Args> || ...);
};

inline std::variant<int, double> v;

template <typename T>
requires is_any_of_impl_4<bool, uv<decltype(v)>::type>
void bar() {}

int main() {
    bar<int>();
}

https://godbolt.org/z/WPdePT
<source>: In instantiation of 'void bar() [with T = int]':

<source>:22:14:   required from here

<source>:12:14: internal compiler error: in tsubst_pack_expansion, at
cp/pt.c:12924

   12 |     requires (std::same_as<T, Args> || ...);

      |     ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Please submit a full bug report,

with preprocessed source if appropriate.

See <https://gcc.gnu.org/bugs/> for instructions.

Compiler returned: 1

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

* [Bug c++/96531] [10/11 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
@ 2020-08-12 12:57 ` ppalka at gcc dot gnu.org
  2020-09-18 18:50 ` ppalka at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-08-12 12:57 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |10.1.0, 10.2.0, 11.0
           Keywords|                            |ice-on-valid-code
   Last reconfirmed|                            |2020-08-12
             Status|UNCONFIRMED                 |NEW
            Summary|ICE for concepts here.      |[10/11 Regression] ICE for
                   |                            |concepts here.
     Ever confirmed|0                           |1
   Target Milestone|---                         |10.3
      Known to work|                            |9.1.0, 9.2.0, 9.3.0
                 CC|                            |nathan at acm dot org,
                   |                            |ppalka at gcc dot gnu.org

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  Here's a reduced valid testcase which exhibits a regression:

template<typename T>
constexpr bool is_bool = false;

template<>
constexpr bool is_bool<bool> = true;

template <typename... Ts>
concept C = requires {
    requires (is_bool<Ts> || ...);
};

template <typename... Ts> requires C<Ts...>
void bar() {}

int main() {
    bar<int, char, bool>();
}

GCC 9.1-9.3 accept this testcase with -std=c++2a -fconcepts, and GCC 10.1, 10.2
and trunk do not (by way of ICE).

It looks like we began ICEing here starting with r10-8077.

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

* [Bug c++/96531] [10/11 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
  2020-08-12 12:57 ` [Bug c++/96531] [10/11 Regression] " ppalka at gcc dot gnu.org
@ 2020-09-18 18:50 ` ppalka at gcc dot gnu.org
  2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-09-18 18:50 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

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

* [Bug c++/96531] [10/11 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
  2020-08-12 12:57 ` [Bug c++/96531] [10/11 Regression] " ppalka at gcc dot gnu.org
  2020-09-18 18:50 ` ppalka at gcc dot gnu.org
@ 2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
  2020-10-07 18:55 ` ppalka at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-09-19 15:18 UTC (permalink / raw)
  To: gcc-bugs

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

--- 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:e5d72c840a226fdbab65912f97d42a1dbdaf6ed2

commit r11-3296-ge5d72c840a226fdbab65912f97d42a1dbdaf6ed2
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Sep 19 11:02:46 2020 -0400

    c++: Fix self-mapping in map_arguments [PR96531, PR97103]

    With r10-8077 we stopped passing the argified current_template_parms to
    normalize_constraint_expression from finish_nested_requirement, and
    instead made map_arguments perform a self-mapping of parameters when
    args is NULL.  But we're currently not handling parameter packs and
    BOUND_TEMPLATE_TEMPLATE_PARMs properly during this self-mapping, which
    leads to ICEs later during satisfaction.

    To properly handle self-mapping of a parameter pack, this patch
    extends template_parm_to_arg to handle TEMPLATE_PARM_P nodes, and
    makes map_arguments use it.  (This change revealed that the call to
    template_parm_to_arg in convert_generic_types_to_packs was a no-op
    because the argument 't' is never a TREE_LIST, so this patch
    additionally removes this call.)

    As for bound ttps, map_arguments before r10-8077 would map a
    BOUND_TEMPLATE_TEMPLATE_PARM not to itself but to its underlying
    TEMPLATE_TEMPLATE_PARM.  We could restore this behavior in
    map_arguments, but since a bound ttp is not really a template parameter
    it seems better to make keep_template_parm not give us a bound ttp in
    the first place.  So this patch makes keep_template_parm return the
    underlying ttp when it sees a bound ttp.

    gcc/cp/ChangeLog:

            PR c++/96531
            PR c++/97103
            * constraint.cc (map_arguments): Call template_parm_to_arg
            in the self-mapping case.
            (finish_shorthand_constraint): No need to build a TREE_LIST
            before calling template_parm_to_arg.
            * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
            nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
            overlying TREE_LIST node optional.
            (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
            instead record its corresponding TEMPLATE_TEMPLATE_PARM.
            (convert_generic_types_to_packs): Don't call
            template_parm_to_arg.

    gcc/testsuite/ChangeLog:

            PR c++/96531
            PR c++/97103
            * g++.dg/cpp2a/concepts-ttp2.C: New test.
            * g++.dg/cpp2a/concepts-variadic1.C: New test.

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

* [Bug c++/96531] [10/11 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
                   ` (2 preceding siblings ...)
  2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
@ 2020-10-07 18:55 ` ppalka at gcc dot gnu.org
  2020-10-12 12:36 ` [Bug c++/96531] [10 " rguenth at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-10-07 18:55 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |src at andyf dot de

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

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

* [Bug c++/96531] [10 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
                   ` (3 preceding siblings ...)
  2020-10-07 18:55 ` ppalka at gcc dot gnu.org
@ 2020-10-12 12:36 ` rguenth at gcc dot gnu.org
  2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
  2021-03-31 12:35 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-10-12 12:36 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|11.0                        |
            Summary|[10/11 Regression] ICE for  |[10 Regression] ICE for
                   |concepts here.              |concepts here.
           Priority|P3                          |P2
      Known to work|                            |11.0

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
Fixed on trunk sofar.

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

* [Bug c++/96531] [10 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
                   ` (4 preceding siblings ...)
  2020-10-12 12:36 ` [Bug c++/96531] [10 " rguenth at gcc dot gnu.org
@ 2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
  2021-03-31 12:35 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-03-31 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

commit r10-9634-ga834e6d59d74ccaefbcbbed5ea7ee25305057853
Author: Patrick Palka <ppalka@redhat.com>
Date:   Sat Sep 19 11:02:46 2020 -0400

    c++: Fix self-mapping in map_arguments [PR96531, PR97103]

    With r10-8077 we stopped passing the argified current_template_parms to
    normalize_constraint_expression from finish_nested_requirement, and
    instead made map_arguments perform a self-mapping of parameters when
    args is NULL.  But we're currently not handling parameter packs and
    BOUND_TEMPLATE_TEMPLATE_PARMs properly during this self-mapping, which
    leads to ICEs later during satisfaction.

    To properly handle self-mapping of a parameter pack, this patch
    extends template_parm_to_arg to handle TEMPLATE_PARM_P nodes, and
    makes map_arguments use it.  (This change revealed that the call to
    template_parm_to_arg in convert_generic_types_to_packs was a no-op
    because the argument 't' is never a TREE_LIST, so this patch
    additionally removes this call.)

    As for bound ttps, map_arguments before r10-8077 would map a
    BOUND_TEMPLATE_TEMPLATE_PARM not to itself but to its underlying
    TEMPLATE_TEMPLATE_PARM.  We could restore this behavior in
    map_arguments, but since a bound ttp is not really a template parameter
    it seems better to make keep_template_parm not give us a bound ttp in
    the first place.  So this patch makes keep_template_parm return the
    underlying ttp when it sees a bound ttp.

    gcc/cp/ChangeLog:

            PR c++/96531
            PR c++/97103
            * constraint.cc (map_arguments): Call template_parm_to_arg
            in the self-mapping case.
            (finish_shorthand_constraint): No need to build a TREE_LIST
            before calling template_parm_to_arg.
            * pt.c (template_parm_to_arg): Rewrite to handle TEMPLATE_PARM_P
            nodes as well as DECL_TEMPLATE_PARM_P nodes, and to make the
            overlying TREE_LIST node optional.
            (keep_template_parm): Don't record a BOUND_TEMPLATE_TEMPLATE_PARM,
            instead record its corresponding TEMPLATE_TEMPLATE_PARM.
            (convert_generic_types_to_packs): Don't call
            template_parm_to_arg.

    gcc/testsuite/ChangeLog:

            PR c++/96531
            PR c++/97103
            * g++.dg/cpp2a/concepts-ttp2.C: New test.
            * g++.dg/cpp2a/concepts-variadic1.C: New test.

    (cherry picked from commit e5d72c840a226fdbab65912f97d42a1dbdaf6ed2)

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

* [Bug c++/96531] [10 Regression] ICE for concepts here.
  2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
                   ` (5 preceding siblings ...)
  2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
@ 2021-03-31 12:35 ` ppalka at gcc dot gnu.org
  6 siblings, 0 replies; 8+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-03-31 12:35 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #6 from Patrick Palka <ppalka at gcc dot gnu.org> ---
fixed.

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

end of thread, other threads:[~2021-03-31 12:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-07 22:38 [Bug c++/96531] New: ICE for concepts here euloanty at live dot com
2020-08-12 12:57 ` [Bug c++/96531] [10/11 Regression] " ppalka at gcc dot gnu.org
2020-09-18 18:50 ` ppalka at gcc dot gnu.org
2020-09-19 15:18 ` cvs-commit at gcc dot gnu.org
2020-10-07 18:55 ` ppalka at gcc dot gnu.org
2020-10-12 12:36 ` [Bug c++/96531] [10 " rguenth at gcc dot gnu.org
2021-03-31 12:33 ` cvs-commit at gcc dot gnu.org
2021-03-31 12:35 ` 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).