https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110031
Bug ID: 110031
Summary: ICE: error reporting routines re-entered on non-type
template argument
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: stevenxia990430 at gmail dot com
Target Milestone: ---
The following program produces internal compiler error: error reporting
routines re-entered. Checked on clang and it was rejected as invalid code.
Tested on gcc trunk.
To quickly reproduce: https://gcc.godbolt.org/z/ex14EKeox
```
#include <type_traits>
#include <iostream>
template <typename T>
constexpr void print_type()
{
std::cout << "Type: " << typeid(T).name();
}
template <typename T, std::enable_if_t<std::is_literal_type_v<std::decay_t<T>>,
int> = 0>
struct A {
A(T &&)
{
}
};
template <typename T>
struct A<T> {
A(T &&) = delete;
};
int main(void)
{
A a{5.3};
return 0;
}
```
Note, if we comment out the A a{5.3}; line in main function, gcc-trunk actually
accept this code (compiles) however it is rejected by clang. Might be related
to this: bug109390