https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110150
Bug ID: 110150
Summary: std::optional inside template leads to long
compilation time
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 is very slow to compile (>40 seconds). Tested on
GCC-trunk.
To quickly reproduce: https://gcc.godbolt.org/z/rsT3n38sY
```
#include <optional>
template<typename T>
void f(T x)
{
f(std::optional<T>(x));
}
int main()
{
using std::optional;
optional<int> x;
f(x);
return 0;
}
```