public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110513] New: Invalid use of incomplete type std::bool_constant inside requires expression
@ 2023-07-01 18:15 fchelnokov at gmail dot com
2023-07-01 18:35 ` [Bug c++/110513] " pinskia at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: fchelnokov at gmail dot com @ 2023-07-01 18:15 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110513
Bug ID: 110513
Summary: Invalid use of incomplete type std::bool_constant
inside requires expression
Product: gcc
Version: 13.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: ---
The following program
#include <type_traits>
struct B {
bool b = true;
};
// ok everywhere
static_assert( std::bool_constant<B{}.b>{}() );
// error in GCC
static_assert( requires() { std::bool_constant<B{}.b>{}(); } );
is accepted in Clang and MSVC, but GCC complains
<source>:11:56: error: invalid use of incomplete type
'std::bool_constant<B{}.b>'
11 | static_assert( requires() { std::bool_constant<B{}.b>{}(); } );
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
In file included from <source>:1:
/opt/compiler-explorer/gcc-13.1.0/include/c++/13.1.0/type_traits:62:12: note:
declaration of 'std::bool_constant<B{}.b>'
62 | struct integral_constant
| ^~~~~~~~~~~~~~~~~
Online demo: https://gcc.godbolt.org/z/csKanbM88
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/110513] Invalid use of incomplete type std::bool_constant inside requires expression
2023-07-01 18:15 [Bug c++/110513] New: Invalid use of incomplete type std::bool_constant inside requires expression fchelnokov at gmail dot com
@ 2023-07-01 18:35 ` pinskia at gcc dot gnu.org
2023-07-01 18:36 ` pinskia at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-01 18:35 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110513
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-07-01
Ever confirmed|0 |1
Keywords| |rejects-valid
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced testcase:
```
template<bool a>
struct bool_const1
{
typedef bool T;
static constexpr T value = a;
constexpr T operator()(){return value;}
};
struct B {
bool b = true;
};
// ok everywhere
static_assert( bool_const1<B{}.b>{}() );
// error in GCC
static_assert( requires() { bool_const1<B{}.b>{}(); } );
```
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/110513] Invalid use of incomplete type std::bool_constant inside requires expression
2023-07-01 18:15 [Bug c++/110513] New: Invalid use of incomplete type std::bool_constant inside requires expression fchelnokov at gmail dot com
2023-07-01 18:35 ` [Bug c++/110513] " pinskia at gcc dot gnu.org
@ 2023-07-01 18:36 ` pinskia at gcc dot gnu.org
2023-07-01 18:40 ` pinskia at gcc dot gnu.org
2023-08-14 18:31 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-01 18:36 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110513
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reduced slightly more:
```
template<bool a>
struct bool_const1 {};
struct B {
bool b = true;
};
// error in GCC
static_assert( requires() { bool_const1<B{}.b>{}; } );
```
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/110513] Invalid use of incomplete type std::bool_constant inside requires expression
2023-07-01 18:15 [Bug c++/110513] New: Invalid use of incomplete type std::bool_constant inside requires expression fchelnokov at gmail dot com
2023-07-01 18:35 ` [Bug c++/110513] " pinskia at gcc dot gnu.org
2023-07-01 18:36 ` pinskia at gcc dot gnu.org
@ 2023-07-01 18:40 ` pinskia at gcc dot gnu.org
2023-08-14 18:31 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-07-01 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110513
--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
The underlaying problem here is most likely the same issue as the one in PR
94332 .
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug c++/110513] Invalid use of incomplete type std::bool_constant inside requires expression
2023-07-01 18:15 [Bug c++/110513] New: Invalid use of incomplete type std::bool_constant inside requires expression fchelnokov at gmail dot com
` (2 preceding siblings ...)
2023-07-01 18:40 ` pinskia at gcc dot gnu.org
@ 2023-08-14 18:31 ` ppalka at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: ppalka at gcc dot gnu.org @ 2023-08-14 18:31 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110513
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ed at catmur dot uk
--- Comment #4 from Patrick Palka <ppalka at gcc dot gnu.org> ---
*** Bug 111016 has been marked as a duplicate of this bug. ***
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-08-14 18:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-01 18:15 [Bug c++/110513] New: Invalid use of incomplete type std::bool_constant inside requires expression fchelnokov at gmail dot com
2023-07-01 18:35 ` [Bug c++/110513] " pinskia at gcc dot gnu.org
2023-07-01 18:36 ` pinskia at gcc dot gnu.org
2023-07-01 18:40 ` pinskia at gcc dot gnu.org
2023-08-14 18:31 ` 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).