-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang] Inconsistent (stateful) compilation of class template default member initializer from parenthesized aggregate initialization #62266
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
Comments
@llvm/issue-subscribers-clang-frontend |
Confirmed: https://godbolt.org/z/s63oh9eMM Modified a bit: template<int I> struct S { int x, y, z = I; };
constexpr S<7> s1a(1, 2);
constexpr S<7> s1{1, 2};
constexpr S<7> s2a(3, 4);
constexpr S<7> s2{3, 4};
int main() {
return s1.z + s2.z + s1a.z + s2a.z;
} It does look related to parens init of aggregates maybe @alanzhao1 might have some ideas here. |
@llvm/issue-subscribers-c-20 |
Candidate patch: https://reviews.llvm.org/D149389 |
@shafik any thoughts on backporting this to 16.0.xx? |
Closing for now since https://reviews.llvm.org/D149389 has been merged. Feel free to reopen if you think this should be backported to the 16.0.X release branch. |
/branch alanzhao1/llvm-project/backport-62266 |
Backporting per discussion in https://reviews.llvm.org/D150122 |
/pull-request llvm/llvm-project-release-prs#441 |
Since 16.0.0 and on trunk 0acb639:
fails with:
Condensed to a single evaluation:
My guess would be that the default member initializer is lazy initialized in templates but this is not provoked by parenthesized aggregate initialization.
The text was updated successfully, but these errors were encountered: