-
Notifications
You must be signed in to change notification settings - Fork 214
Open
Description
Describe the bug
A templated constructor taking no parameters does not mask the implicit default constructor as it should. CDT still allows calls to the implicit default constructor without highlighting an error. This also has implications for SFINAE as the example below shows; a call to the default constructor should trigger substitution failure, but doesn't.
To Reproduce
class Foo {
public:
template <typename T> Foo() {}
};
template <typename T, typename U>
struct Bar {
constexpr static int val = 99;
};
template <typename T>
struct Bar<T, decltype(T())> {
// no val member
};
constexpr int v = Bar<Foo,Foo>::val; // incorrectly marked with error
Expected behavior
The final line should not be marked as an error (SFINAE should prevent the partial specialisation of Bar
from being used in the expression, and the default Bar
has the requested variable).
Version Information (please complete the following information):
- OS: Linux but N/A
- Eclipse Version: 2025-06 (4.36)
- CDT Version: 12.1.0.202506041907
Additional context
N/A
Metadata
Metadata
Assignees
Labels
No labels