This is an archive of the discontinued LLVM Phabricator instance.

let EST_Uninstantiated in FunctionProtoType::canThrow return CT_Dependent
ClosedPublic

Authored by zhouyizhou on Mar 11 2022, 3:15 PM.

Details

Summary

When compile following code without -std=c++17, clang will abort by llvm_unreachable:

class A {
public:

static const char X;

};
const char A::X = 0;

template<typename U> void func() noexcept(U::X);

template<class... B, char x>
void foo(void(B...) noexcept(x)) {}

void bar()
{

foo(func<A>);

}

So, my solution is to let EST_Uninstantiated in FunctionProtoType::canThrow return CT_Dependent

Thanks
Zhouyi Zhou <zhouzhouyi@gmail.com>

Diff Detail

Event Timeline

zhouyizhou created this revision.Mar 11 2022, 3:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2022, 3:15 PM
zhouyizhou requested review of this revision.Mar 11 2022, 3:15 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 11 2022, 3:15 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript

This seems reasonable to me, but can you please add a lit test and fix the format of the code in your commit message?

This seems reasonable to me, but can you please add a lit test and fix the format of the code in your commit message?

Thank you for reviewing the patch for me ;-) I am a beginner, please give me a couple of days to add the lit test and fix the format of the code in my commit message and make my patch better.

Thanks again
Zhouyi

zhouyizhou edited the summary of this revision. (Show Details)
zhouyizhou edited the summary of this revision. (Show Details)
zhouyizhou edited the summary of this revision. (Show Details)

1 small request, otherwise LGTM.

clang/lib/AST/Type.cpp
3330

Slight preference for moving just this line to 3351 (above or below) to get the fallthrough behavior on the existing CT_Dependent without condition.

erichkeane accepted this revision.Mar 16 2022, 6:40 AM

LGTM! Let me know if you need me to commit this for you (and if so, what name/email address you'd like it committed under).

This revision is now accepted and ready to land.Mar 16 2022, 6:40 AM

LGTM! Let me know if you need me to commit this for you (and if so, what name/email address you'd like it committed under).

Thank you for your guidance!
I do need you to commit this for me. I want my name and following email address be committed with the patch:
Zhouyi Zhou<zhouzhouyi@gmail.com>

Thanks again
Zhouyi

clang/lib/AST/Type.cpp
3330

thank you for your guidance, thanks zhouyi

This revision was landed with ongoing or failed builds.Mar 16 2022, 7:09 AM
This revision was automatically updated to reflect the committed changes.