This is an archive of the discontinued LLVM Phabricator instance.

Workaround for EvalInfo ctor for MSVC 2017
ClosedPublic

Authored by yaxunl on Nov 26 2019, 10:17 AM.

Details

Summary

Current EvalInfo ctor causes EnableNewConstInterp to be true even though
it is supposed to be false on MSVC 2017. This is because a virtual function
getLangOpts() is called in member initializer lists, whereas on MSVC
member ctors are called before function virtual function pointers are
initialized.

https://docs.microsoft.com/en-us/cpp/cpp/constructors-cpp?view=vs-2019#order_of_construction

This patch fixes that.

Diff Detail

Event Timeline

yaxunl created this revision.Nov 26 2019, 10:17 AM
yaxunl updated this revision to Diff 231101.Nov 26 2019, 10:35 AM

add a test

hliao accepted this revision.Nov 26 2019, 11:00 AM

LGTM, anyway calling a virtual function inside the constructor is not encouraged.

This revision is now accepted and ready to land.Nov 26 2019, 11:00 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptNov 26 2019, 6:45 PM