https://gcc.gnu.org/bugzilla/show_bug.cgi?id=123391
Bug ID: 123391
Summary: [GCC 15 regression] __is_trivial fails for type with
two trivial default constructors
Product: gcc
Version: 15.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: arthur.j.odwyer at gmail dot com
Target Milestone: ---
// https://godbolt.org/z/c5a7eM45P
template<class T>
struct S {
S() requires (sizeof(T) > 3) = default;
S() requires (sizeof(T) < 5) = default;
};
static_assert(__is_trivial(S<int>));
static_assert(!__is_constructible(S<int>)); // because ambiguity
GCC 14 is happy with this (as is Clang, as is the paper standard). But GCC 15
has started complaining:
<source>:10:15: error: static assertion failed
10 | static_assert(__is_trivial(S<int>));
| ^~~~~~~~~~~~~~~~~~~~
Now, this is a weird corner case in an already-deprecated nonsense trait, which
suggests low priority; but it's also a GCC 14->15 *regression*, which suggests
higher priority.
Circumstantial evidence points at Marek Polacek's fix for
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108769 which landed in the GCC 15
cycle.