This is an archive of the discontinued LLVM Phabricator instance.

[Sema][NFC] add check before using `BuildExpressionFromIntegralTemplateArgument`
AbandonedPublic

Authored by HerrCai0907 on Apr 21 2023, 3:15 AM.

Details

Summary

This patch wants to avoid Sema crash for inline friend decl like

template <class F1> int foo(F1 X);
template <int A1> struct A {
  template <class F1> friend int foo(F1 X) { return A1; }
};

template struct A<1>;
int a = foo(1.0);

But this case is still not fixed

Diff Detail

Event Timeline

HerrCai0907 created this revision.Apr 21 2023, 3:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 3:15 AM
HerrCai0907 requested review of this revision.Apr 21 2023, 3:15 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 21 2023, 3:15 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
erichkeane requested changes to this revision.Apr 21 2023, 6:37 AM

This is the wrong fix here, the crash is appropriate here, else we're not getting the type right. For your example, we need to be setting up the template arguments correctly.

This revision now requires changes to proceed.Apr 21 2023, 6:37 AM

See my comment on https://github.com/llvm/llvm-project/issues/62265 for results of my debugging.

HerrCai0907 abandoned this revision.Apr 22 2023, 12:10 AM