https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110150
Andrew Pinski <pinskia at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |compile-time-hog
--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I am not shocked because even this takes some time (not as much as the original
one):
```
template <typename T>
struct optional
{
T a;
optional();
template<typename O>
optional(const optional<O>&);
};
template<typename T>
void f(T x)
{
f(optional<T>(x));
}
int main()
{
// using std::optional;
optional<int> x;
f(x);
return 0;
}
```
There is an enable if on the optional constructor in the std::optional case
which makes the time increase even more.
I doubt there is much to be optimized here except maybe lowering the template
depth limit (from the current 900, that is -ftemplate-depth=900 is the
default).