public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101670] New: Internal compiler error with concepts
@ 2021-07-29  6:40 fchelnokov at gmail dot com
  2021-07-29 16:08 ` [Bug c++/101670] " joeloser93 at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: fchelnokov at gmail dot com @ 2021-07-29  6:40 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 101670
           Summary: Internal compiler error with concepts
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: fchelnokov at gmail dot com
  Target Milestone: ---

```
#include <type_traits>

template <typename T, typename V = void, auto = []{}> constexpr bool
is_incomplete = true;
template <typename T> constexpr bool is_incomplete<T,
std::enable_if_t<sizeof(T)>> = false;

template <typename T> concept Incomplete = is_incomplete<T>;
template <Incomplete> struct S {};

struct A;
S<A> s1;
```
https://gcc.godbolt.org/z/McPf9v8s3

In substitution of 'template<class>  requires  Incomplete<
<template-parameter-1-1> > struct S [with <template-parameter-1-1> = A]':
<source>:10:4:   required from here
<source>:6:44: internal compiler error: in unify, at cp/pt.c:24165
    6 | template <typename T> concept Incomplete = is_incomplete<T>;
      |                                            ^~~~~~~~~~~~~~~~
0x1d80e09 internal_error(char const*, ...)
        ???:0
0x7311fd fancy_abort(char const*, int, char const*)
        ???:0
0x9c9a26 most_specialized_partial_spec(tree_node*, int)
        ???:0
0x9caad5 instantiate_template(tree_node*, tree_node*, int)
        ???:0
0x9cb9d5 finish_template_variable(tree_node*, int)
        ???:0
0x9cbb56 lookup_and_finish_template_variable(tree_node*, tree_node*, int)
        ???:0
0x7b9d5a constraints_satisfied_p(tree_node*, tree_node*)
        ???:0
0x9a6c10 lookup_template_class(tree_node*, tree_node*, tree_node*, tree_node*,
int, int)
        ???:0
0x9ff09d finish_template_type(tree_node*, tree_node*, int)
        ???:0
0x95f1c5 c_parse_file()
        ???:0
0xae2a62 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions

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

* [Bug c++/101670] Internal compiler error with concepts
  2021-07-29  6:40 [Bug c++/101670] New: Internal compiler error with concepts fchelnokov at gmail dot com
@ 2021-07-29 16:08 ` joeloser93 at gmail dot com
  2021-08-03 12:12 ` marxin at gcc dot gnu.org
  2022-10-06  6:57 ` fchelnokov at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: joeloser93 at gmail dot com @ 2021-07-29 16:08 UTC (permalink / raw)
  To: gcc-bugs

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

Joe Loser <joeloser93 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joeloser93 at gmail dot com

--- Comment #1 from Joe Loser <joeloser93 at gmail dot com> ---
Here's a simple workaround using concepts directly:

```
template <class T> concept Complete = requires(T t) { sizeof(t); };
template <class T> concept Incomplete = !Complete<T>;
template <Incomplete> struct S {};

struct A;
S<A> s1;

struct A {};
S<A> s2;
```



See it live at https://gcc.godbolt.org/z/MjKoM8dP6

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

* [Bug c++/101670] Internal compiler error with concepts
  2021-07-29  6:40 [Bug c++/101670] New: Internal compiler error with concepts fchelnokov at gmail dot com
  2021-07-29 16:08 ` [Bug c++/101670] " joeloser93 at gmail dot com
@ 2021-08-03 12:12 ` marxin at gcc dot gnu.org
  2022-10-06  6:57 ` fchelnokov at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: marxin at gcc dot gnu.org @ 2021-08-03 12:12 UTC (permalink / raw)
  To: gcc-bugs

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

Martin Liška <marxin at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
                 CC|                            |jason at gcc dot gnu.org,
                   |                            |marxin at gcc dot gnu.org
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2021-08-03

--- Comment #2 from Martin Liška <marxin at gcc dot gnu.org> ---
Likely started with r10-3735-gcb57504a55015891.

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

* [Bug c++/101670] Internal compiler error with concepts
  2021-07-29  6:40 [Bug c++/101670] New: Internal compiler error with concepts fchelnokov at gmail dot com
  2021-07-29 16:08 ` [Bug c++/101670] " joeloser93 at gmail dot com
  2021-08-03 12:12 ` marxin at gcc dot gnu.org
@ 2022-10-06  6:57 ` fchelnokov at gmail dot com
  2 siblings, 0 replies; 4+ messages in thread
From: fchelnokov at gmail dot com @ 2022-10-06  6:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Fedor Chelnokov <fchelnokov at gmail dot com> ---
A shorter example:

template <typename, auto =[]{}> concept x = true;
void foo(x auto) {}

Online demo: https://godbolt.org/z/sT74G8crE

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

end of thread, other threads:[~2022-10-06  6:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-29  6:40 [Bug c++/101670] New: Internal compiler error with concepts fchelnokov at gmail dot com
2021-07-29 16:08 ` [Bug c++/101670] " joeloser93 at gmail dot com
2021-08-03 12:12 ` marxin at gcc dot gnu.org
2022-10-06  6:57 ` fchelnokov 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).