-
Notifications
You must be signed in to change notification settings - Fork 12.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang-cl] Self instantiation does not work in a constant expression #108962
Comments
@llvm/issue-subscribers-c-1 Author: None (VladimirShchigolev)
Consider the following example:
```
template <int I = 0>
struct S {
static constexpr int A = I;
static constexpr int B = S<>::A;
};
static_assert(S<1>::B == 0, "S<1>::B should be 0");
```
Latest MSVC (14.41) is able to compile this:
However clang-cl fails to compile:
Here is a draft patch that I tried to make while working at #47033. It does not work - it removes the errors, but the assert fails. Maybe it will help.
|
@llvm/issue-subscribers-clang-frontend Author: None (VladimirShchigolev)
Consider the following example:
```
template <int I = 0>
struct S {
static constexpr int A = I;
static constexpr int B = S<>::A;
};
static_assert(S<1>::B == 0, "S<1>::B should be 0");
```
Latest MSVC (14.41) is able to compile this:
However clang-cl fails to compile:
Here is a draft patch that I tried to make while working at #47033. It does not work - it removes the errors, but the assert fails. Maybe it will help.
|
static constexpr int B = S::A;
|
Consider the following example:
Latest MSVC (14.41) is able to compile this:
However clang-cl fails to compile:
Here is a draft patch that I tried to make while working at #47033. It does not work - it removes the errors, but the assert fails. Maybe it will help.
The text was updated successfully, but these errors were encountered: