-
Notifications
You must be signed in to change notification settings - Fork 10.8k
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 crash on valid code since #87933 #92414
Comments
@llvm/issue-subscribers-clang-frontend Author: None (yronglin)
```C++
namespace std {
template <class T> class initializer_list {};
}
template <typename T, int> class C { template <typename T> using Ptr =__remove_pointer(T) *; class A { struct B : A {
./main.cpp:23:28: error: no viable constructor or deduction guide for deduction of template arguments of 'C'
|
This does not crash for me: https://godbolt.org/z/9Eec5333E Can you confirm this still crashes and if so provide a godbolt. |
I've debug in local. The crash issue caused by initializer rebuild failed in
llvm-project/clang/lib/Sema/SemaExpr.cpp
Lines 5717 to 5721 in 8e00703
SFINAETrap Trap(*this);
, we can got diagnostics like the following:But why does the check pass during Parse phase but fails when we rebuilding
CXXDefaultInitExpr
? Through tracing, I found that the root cause was the parameterbool ListInitialization
that passed toRebuildCXXTemporaryObjectExpr
(fall throuth toSema::BuildCXXTypeConstructExpr
). During parsing,ListInitialization
wastrue
, but it becamefalse
during rebuilding, it's causeInitializationKind
to become DirectInit instead of DirectListInit. Finally, causingSema::DeduceTemplateSpecializationFromInitializer
fail.llvm-project/clang/lib/Sema/TreeTransform.h
Lines 14116 to 14121 in 8e00703
Therefore, I think the key to the problem is to fix
TreeTransform.h:14116
's FIXME. As the comments inTreeTransform.h:14116
said, we should passE->isListInitialization()
, becauseE
is actually list initialization, I have tried this modification, but it will cause 3 lit failures. We have not try to rebuild theCXXDefaultInitExpr
before this PR, so it's works fine before.The text was updated successfully, but these errors were encountered: