public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/97402] New: Value of dependent partial-concept-id is not usable in a constant expression
@ 2020-10-13 12:18 ed at catmur dot uk
  2020-10-15 19:02 ` [Bug c++/97402] " ppalka at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: ed at catmur dot uk @ 2020-10-13 12:18 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 97402
           Summary: Value of dependent partial-concept-id is not usable in
                    a constant expression
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ed at catmur dot uk
  Target Milestone: ---

#include <concepts>
template<class T> void f(T x) {
    std::same_as<T> auto y = x;
}
int main() { f(1); }

In file included from <source>:1:
<source>: In instantiation of 'void f(T) [with T = int]':
<source>:5:17:   required from here
.../gcc-trunk-20201013/include/c++/11.0.0/concepts:57:15:   required for the
satisfaction of '__same_as<_Tp, _Up>' [with _Tp = int; _Up = T]
.../gcc-trunk-20201013/include/c++/11.0.0/concepts:57:32: error: the value of
'std::is_same_v<int, T>' is not usable in a constant expression
   57 |       concept __same_as = std::is_same_v<_Tp, _Up>;
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~
In file included from .../gcc-trunk-20201013/include/c++/11.0.0/concepts:44,
                 from <source>:1:
.../gcc-trunk-20201013/include/c++/11.0.0/type_traits:3220:25: note:
'std::is_same_v<int, T>' used in its own initializer
 3220 |   inline constexpr bool is_same_v = __is_same(_Tp, _Up);
      |                         ^~~~~~~~~
<source>:3:26: error: deduced initializer does not satisfy placeholder
constraints
    3 |     std::same_as<T> auto y = x;
      |                          ^
<source>:3:26: note: constraints not satisfied

https://godbolt.org/z/qGT5xe

Changing std::same_as<T> to std::same_as<int> makes it compile OK.

Feels a little like 96410.

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

* [Bug c++/97402] Value of dependent partial-concept-id is not usable in a constant expression
  2020-10-13 12:18 [Bug c++/97402] New: Value of dependent partial-concept-id is not usable in a constant expression ed at catmur dot uk
@ 2020-10-15 19:02 ` ppalka at gcc dot gnu.org
  2021-01-10 13:58 ` kirshamir at gmail dot com
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2020-10-15 19:02 UTC (permalink / raw)
  To: gcc-bugs

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

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
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96443,
                   |                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96444
     Ever confirmed|0                           |1
                 CC|                            |ppalka at gcc dot gnu.org
   Last reconfirmed|                            |2020-10-15
             Status|UNCONFIRMED                 |ASSIGNED

--- Comment #1 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Confirmed.  See also PR96443 and PR96444.

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

* [Bug c++/97402] Value of dependent partial-concept-id is not usable in a constant expression
  2020-10-13 12:18 [Bug c++/97402] New: Value of dependent partial-concept-id is not usable in a constant expression ed at catmur dot uk
  2020-10-15 19:02 ` [Bug c++/97402] " ppalka at gcc dot gnu.org
@ 2021-01-10 13:58 ` kirshamir at gmail dot com
  2021-01-10 14:25 ` kirshamir at gmail dot com
  2021-01-18 16:46 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kirshamir at gmail dot com @ 2021-01-10 13:58 UTC (permalink / raw)
  To: gcc-bugs

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

Amir Kirsh <kirshamir at gmail dot com> changed:

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

--- Comment #2 from Amir Kirsh <kirshamir at gmail dot com> ---
See also:
https://stackoverflow.com/questions/65653983/gcc-stdis-same-vint-t-is-not-usable-in-a-constant-expression

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

* [Bug c++/97402] Value of dependent partial-concept-id is not usable in a constant expression
  2020-10-13 12:18 [Bug c++/97402] New: Value of dependent partial-concept-id is not usable in a constant expression ed at catmur dot uk
  2020-10-15 19:02 ` [Bug c++/97402] " ppalka at gcc dot gnu.org
  2021-01-10 13:58 ` kirshamir at gmail dot com
@ 2021-01-10 14:25 ` kirshamir at gmail dot com
  2021-01-18 16:46 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: kirshamir at gmail dot com @ 2021-01-10 14:25 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Amir Kirsh <kirshamir at gmail dot com> ---
Playing with the code even leads to compiler seg-fault, see:

https://stackoverflow.com/a/65654043/2085626

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

* [Bug c++/97402] Value of dependent partial-concept-id is not usable in a constant expression
  2020-10-13 12:18 [Bug c++/97402] New: Value of dependent partial-concept-id is not usable in a constant expression ed at catmur dot uk
                   ` (2 preceding siblings ...)
  2021-01-10 14:25 ` kirshamir at gmail dot com
@ 2021-01-18 16:46 ` ppalka at gcc dot gnu.org
  3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2021-01-18 16:46 UTC (permalink / raw)
  To: gcc-bugs

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

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

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

--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
This is essentially a dup of PR96444, I think.

*** This bug has been marked as a duplicate of bug 96444 ***

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

end of thread, other threads:[~2021-01-18 16:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 12:18 [Bug c++/97402] New: Value of dependent partial-concept-id is not usable in a constant expression ed at catmur dot uk
2020-10-15 19:02 ` [Bug c++/97402] " ppalka at gcc dot gnu.org
2021-01-10 13:58 ` kirshamir at gmail dot com
2021-01-10 14:25 ` kirshamir at gmail dot com
2021-01-18 16:46 ` 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).