c++: defaulted ctor vs template ctor
Fixes a compiler cycle related to defaulted constructors and template constructors in C++.
This commit resolves a circular dependency issue in C++ when the compiler tries to lazily declare the RE move constructor while considering a template constructor. The fix involves handling LOOKUP_DEFAULTED in check_non_deducible_conversions to break the cycle. A new test case is added.
In Details
The commit addresses a CWG1092-related cycle in cp/pt.cc within check_non_deducible_conversions. The cycle occurs when lazily declaring the RE move constructor and considering a constructor template that takes RE&, leading to recursive attempts to declare the RE constructors. By handling LOOKUP_DEFAULTED, the cycle is broken. This is a C++ front-end issue with no direct impact on other compiler stages.
For Context
In C++, constructors are special functions that create objects. Sometimes, the compiler can automatically generate a default constructor if you don't define one yourself. This commit fixes a bug where the compiler would get stuck in a loop when trying to figure out which constructor to use in a complex situation involving template constructors. The fix ensures that the compiler correctly handles these situations, avoiding infinite loops and allowing the code to compile successfully.