public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110256] New: passing concept to concept compiles
@ 2023-06-14 17:59 ldalessandro at gmail dot com
  2023-06-14 18:06 ` [Bug c++/110256] " pinskia at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ldalessandro at gmail dot com @ 2023-06-14 17:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 110256
           Summary: passing concept to concept compiles
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ldalessandro at gmail dot com
  Target Milestone: ---

I accidentally passed a concept to convertible_to and was surprised to see it
compile.

```
#include <concepts>

template <class T>
concept b = requires (T t ) {
    { auto(t) } -> std::convertible_to<std::integral>;
};

static_assert(b<int>);
```

https://godbolt.org/z/jh53n185s

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

* [Bug c++/110256] passing concept to concept compiles
  2023-06-14 17:59 [Bug c++/110256] New: passing concept to concept compiles ldalessandro at gmail dot com
@ 2023-06-14 18:06 ` pinskia at gcc dot gnu.org
  2023-06-14 18:09 ` pinskia at gcc dot gnu.org
  2023-06-20 14:14 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-14 18:06 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced to:
```
template<class T>
concept c = true;
template<class T, class T1>
concept  d = false;

template <class T>
concept b = requires (T t ) {
    { t } -> d<c>;
};

static_assert(!b<int>);
```

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

* [Bug c++/110256] passing concept to concept compiles
  2023-06-14 17:59 [Bug c++/110256] New: passing concept to concept compiles ldalessandro at gmail dot com
  2023-06-14 18:06 ` [Bug c++/110256] " pinskia at gcc dot gnu.org
@ 2023-06-14 18:09 ` pinskia at gcc dot gnu.org
  2023-06-20 14:14 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-06-14 18:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
MSVC also accepts this code ...
It might be the case that clang is incorrectly rejecting it.
Basically the way I understand is that b will always be false due to incorrect
usage of std::integral/c here. templates can be used as a template argument
even.

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

* [Bug c++/110256] passing concept to concept compiles
  2023-06-14 17:59 [Bug c++/110256] New: passing concept to concept compiles ldalessandro at gmail dot com
  2023-06-14 18:06 ` [Bug c++/110256] " pinskia at gcc dot gnu.org
  2023-06-14 18:09 ` pinskia at gcc dot gnu.org
@ 2023-06-20 14:14 ` ppalka at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-06-20 14:14 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
                 CC|                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2023-06-20
     Ever confirmed|0                           |1

--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
We also incorrectly accept:

  template<class> concept c = true;
  template<class, class> concept d = true;
  d<c auto> auto x = 0;

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

end of thread, other threads:[~2023-06-20 14:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-14 17:59 [Bug c++/110256] New: passing concept to concept compiles ldalessandro at gmail dot com
2023-06-14 18:06 ` [Bug c++/110256] " pinskia at gcc dot gnu.org
2023-06-14 18:09 ` pinskia at gcc dot gnu.org
2023-06-20 14:14 ` 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).