[Bug c++/94333] New: internal compiler error: Segmentation fault ( when trying use structure binding in requires(requires{}))
dmusiienko at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Mar 25 18:10:32 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94333
Bug ID: 94333
Summary: internal compiler error: Segmentation fault ( when
trying use structure binding in requires(requires{}))
Product: gcc
Version: c++-concepts
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: dmusiienko at gmail dot com
Target Milestone: ---
template <class T>
struct has2param
{
typedef char yes;
typedef struct{char n[2];} no;
template <class U>
static yes check(U u) requires(requires{[](auto u){auto [a, b] = u;}(u);});
static no check(...);
static constexpr bool y = sizeof(check(T())) == sizeof(yes);
};
struct point
{
int x;
int y;
};
int main()
{
point p{1, 2};
constexpr bool ans = has2param<decltype(p)>::y;
return 0;
}
---------------------------------------
x86-64 gcc(trunc) compiler output:
---------------------------------------
<source>: In instantiation of 'static has2param<T>::yes has2param<T>::check(U)
requires requires{(<lambda>)(has2param<T>::check::u);} [with U = point; T =
point; has2param<T>::yes = char]':
<source>:9:43: required from 'constexpr const bool has2param<point>::y'
<source>:21:50: required from here
<source>:7:45: internal compiler error: Segmentation fault
7 | static yes check(U u) requires(requires{[](auto u){auto [a, b] =
u;}(u);});
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
-----------------------------------------------------
I expected an error, but not the one I received (compiler segf)
More information about the Gcc-bugs
mailing list