public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed
@ 2024-04-07 8:38 ted at lyncon dot se
2024-04-07 8:42 ` [Bug c++/114625] requires { T{}; } wrongly accepted when T{} is ill-formed while in concept ted at lyncon dot se
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: ted at lyncon dot se @ 2024-04-07 8:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
Bug ID: 114625
Summary: requires { T{}; } wrongly accepted when T{} is
ill-formed
Product: gcc
Version: 14.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: ted at lyncon dot se
Target Milestone: ---
This program compiles but I'd expect both `static_assert`s to refuse it since
`d x{};` is invalid.
```
#include <concepts>
template<class T>
concept default_initializable =
std::constructible_from<T> &&
requires { T{}; } &&
requires { ::new T; };
struct b { explicit b(auto...) {} };
struct d : b {};
int main() {
static_assert(default_initializable<d>);
static_assert(std::default_initializable<d>);
//d x{}; // ERROR
}
```
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114625] requires { T{}; } wrongly accepted when T{} is ill-formed while in concept
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
@ 2024-04-07 8:42 ` ted at lyncon dot se
2024-04-07 9:07 ` pinskia at gcc dot gnu.org
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ted at lyncon dot se @ 2024-04-07 8:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
Ted Lyngmo <ted at lyncon dot se> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|requires { T{}; } wrongly |requires { T{}; } wrongly
|accepted when T{} is |accepted when T{} is
|ill-formed |ill-formed while in concept
CC| |ted at lyncon dot se
--- Comment #1 from Ted Lyngmo <ted at lyncon dot se> ---
The assertion correctly fails with this though:
```
static_assert(requires { d{}; });
```
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114625] requires { T{}; } wrongly accepted when T{} is ill-formed while in concept
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
2024-04-07 8:42 ` [Bug c++/114625] requires { T{}; } wrongly accepted when T{} is ill-formed while in concept ted at lyncon dot se
@ 2024-04-07 9:07 ` pinskia at gcc dot gnu.org
2024-04-10 22:21 ` [Bug c++/114625] requires { T{}; } wrongly returns false " ppalka at gcc dot gnu.org
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-07 9:07 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2024-04-07
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114625] requires { T{}; } wrongly returns false when T{} is ill-formed while in concept
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
2024-04-07 8:42 ` [Bug c++/114625] requires { T{}; } wrongly accepted when T{} is ill-formed while in concept ted at lyncon dot se
2024-04-07 9:07 ` pinskia at gcc dot gnu.org
@ 2024-04-10 22:21 ` ppalka at gcc dot gnu.org
2024-04-11 14:59 ` mpolacek at gcc dot gnu.org
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: ppalka at gcc dot gnu.org @ 2024-04-10 22:21 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mpolacek at gcc dot gnu.org,
| |ppalka at gcc dot gnu.org
See Also| |https://gcc.gnu.org/bugzill
| |a/show_bug.cgi?id=94885
--- Comment #3 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Non-concepts testcase:
struct b { explicit b(); };
struct d : b {};
template<class T, class = decltype(T{})> void f(int) = delete;
template<class T> void f(...);
int main() {
f<d>(0);
}
This seems related to PR94885 / r11-20-g30da2906ac5217, maybe Marek would be
interested.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114625] requires { T{}; } wrongly returns false when T{} is ill-formed while in concept
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
` (2 preceding siblings ...)
2024-04-10 22:21 ` [Bug c++/114625] requires { T{}; } wrongly returns false " ppalka at gcc dot gnu.org
@ 2024-04-11 14:59 ` mpolacek at gcc dot gnu.org
2024-04-15 18:20 ` ted at lyncon dot se
2024-04-15 20:12 ` [Bug c++/114625] requires { T{}; } wrongly returns true when T{} is ill-formed while in concept/decltype pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: mpolacek at gcc dot gnu.org @ 2024-04-11 14:59 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
Marek Polacek <mpolacek at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Assignee|unassigned at gcc dot gnu.org |mpolacek at gcc dot gnu.org
Status|NEW |ASSIGNED
--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Thanks. Probably GCC 15 work.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114625] requires { T{}; } wrongly returns false when T{} is ill-formed while in concept
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
` (3 preceding siblings ...)
2024-04-11 14:59 ` mpolacek at gcc dot gnu.org
@ 2024-04-15 18:20 ` ted at lyncon dot se
2024-04-15 20:12 ` [Bug c++/114625] requires { T{}; } wrongly returns true when T{} is ill-formed while in concept/decltype pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: ted at lyncon dot se @ 2024-04-15 18:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
--- Comment #5 from Ted Lyngmo <ted at lyncon dot se> ---
@Andrew, the title change seems wrong. It wrongly returns true when T{} is
ill-formed.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [Bug c++/114625] requires { T{}; } wrongly returns true when T{} is ill-formed while in concept/decltype
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
` (4 preceding siblings ...)
2024-04-15 18:20 ` ted at lyncon dot se
@ 2024-04-15 20:12 ` pinskia at gcc dot gnu.org
5 siblings, 0 replies; 7+ messages in thread
From: pinskia at gcc dot gnu.org @ 2024-04-15 20:12 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114625
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|requires { T{}; } wrongly |requires { T{}; } wrongly
|returns false when T{} is |returns true when T{} is
|ill-formed while in concept |ill-formed while in
| |concept/decltype
--- Comment #6 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Ted Lyngmo from comment #5)
> @Andrew, the title change seems wrong. It wrongly returns true when T{} is
> ill-formed.
Sorry you are correct. I have corrected the summary.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-04-15 20:12 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-07 8:38 [Bug c++/114625] New: requires { T{}; } wrongly accepted when T{} is ill-formed ted at lyncon dot se
2024-04-07 8:42 ` [Bug c++/114625] requires { T{}; } wrongly accepted when T{} is ill-formed while in concept ted at lyncon dot se
2024-04-07 9:07 ` pinskia at gcc dot gnu.org
2024-04-10 22:21 ` [Bug c++/114625] requires { T{}; } wrongly returns false " ppalka at gcc dot gnu.org
2024-04-11 14:59 ` mpolacek at gcc dot gnu.org
2024-04-15 18:20 ` ted at lyncon dot se
2024-04-15 20:12 ` [Bug c++/114625] requires { T{}; } wrongly returns true when T{} is ill-formed while in concept/decltype pinskia 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).