public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/105693] New: Requires-clause constructor is not selected
@ 2022-05-22 18:40 fchelnokov at gmail dot com
2022-10-26 20:37 ` [Bug c++/105693] " pinskia at gcc dot gnu.org
2022-10-26 20:42 ` [Bug c++/105693] Requires-clause constructor that is deleted is not overriding the "= default" one pinskia at gcc dot gnu.org
0 siblings, 2 replies; 3+ messages in thread
From: fchelnokov at gmail dot com @ 2022-05-22 18:40 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105693
Bug ID: 105693
Summary: Requires-clause constructor is not selected
Product: gcc
Version: 12.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: fchelnokov at gmail dot com
Target Milestone: ---
In the following program struct template A has deleted default constructor for
T=int:
#include <concepts>
template<typename T>
struct A {
A() = default;
A() requires (std::same_as<T,int>) = delete;
};
A<int> a;
The program is rejected by Clang and MSVC, but not by GCC. Demo:
https://gcc.godbolt.org/z/G7T5xv35q
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/105693] Requires-clause constructor is not selected
2022-05-22 18:40 [Bug c++/105693] New: Requires-clause constructor is not selected fchelnokov at gmail dot com
@ 2022-10-26 20:37 ` pinskia at gcc dot gnu.org
2022-10-26 20:42 ` [Bug c++/105693] Requires-clause constructor that is deleted is not overriding the "= default" one pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-26 20:37 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105693
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Ever confirmed|0 |1
Status|UNCONFIRMED |NEW
Last reconfirmed| |2022-10-26
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Confirmed. reduced testcase without includes:
```
template<typename T, typename T1>
constexpr bool same = false;
template<typename T>
constexpr bool same<T, T> = true;
template<typename T>
struct A {
A() = default;
A() requires (same<T,int>) = delete;
};
A<int> a;
```
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/105693] Requires-clause constructor that is deleted is not overriding the "= default" one
2022-05-22 18:40 [Bug c++/105693] New: Requires-clause constructor is not selected fchelnokov at gmail dot com
2022-10-26 20:37 ` [Bug c++/105693] " pinskia at gcc dot gnu.org
@ 2022-10-26 20:42 ` pinskia at gcc dot gnu.org
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-10-26 20:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105693
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|Requires-clause constructor |Requires-clause constructor
|is not selected |that is deleted is not
| |overriding the "= default"
| |one
--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Note the Requires-clause constructor is selected as you can see if you do:
```
template<typename T, typename T1>
constexpr bool same = true;
template<typename T>
struct A {
A() = default;
A() requires (same<T,int>){};
};
A<int> a;
```
And see a constructor is called. Just that the "= delete" is not being
rejected.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-10-26 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-22 18:40 [Bug c++/105693] New: Requires-clause constructor is not selected fchelnokov at gmail dot com
2022-10-26 20:37 ` [Bug c++/105693] " pinskia at gcc dot gnu.org
2022-10-26 20:42 ` [Bug c++/105693] Requires-clause constructor that is deleted is not overriding the "= default" one 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).