https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94003
Bug ID: 94003
Summary: is_constructible seems to have sideeffects
Product: gcc
Version: 9.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: julius_huelsmann at freenet dot de
Target Milestone: ---
When executing the following code
#include <type_traits>
```c++
class Class { Class() {} };
template <typename X> static bool why() { return
std::is_constructible<Class>::value; }
int main() { return std::is_constructible<Class>::value; }
```
the is_constructible returns true (which -- as I understand it -- should not be
the case as `Class` has a private constructor. When commenting out the static
templated function why, the return value of is_constructible changes. This
cannot be intended.
The following behavior is observed:
- when using is_constructible_v instead of is_constructible, the result is 1
and does not change
- the bug appears to only occus when declaring a templated static function
"above" the first check of is_constructible