Page MenuHomePhabricator

clang-cl: Ignore /Zc:externConstexpr and /Zc:throwingNew
Needs ReviewPublic

Authored by ki.stfu on Sep 9 2020, 4:57 AM.

Details

Summary

The first option tells the compiler to use external linkage for constexpr variables, and the second one prevents null checks after operator new which can throw.

See https://docs.microsoft.com/en-us/cpp/build/reference/zc-externconstexpr and https://docs.microsoft.com/en-us/cpp/build/reference/zc-throwingnew-assume-operator-new-throws

Diff Detail

Event Timeline

ki.stfu created this revision.Sep 9 2020, 4:57 AM
Herald added a project: Restricted Project. · View Herald TranscriptSep 9 2020, 4:57 AM
ki.stfu requested review of this revision.Sep 9 2020, 4:58 AM

Not sure, but I'd be surprised if Clang behaves like MSVC in one of these cases.

hans added a comment.Nov 4 2020, 5:03 AM

I'm not sure ignoring these is the right thing to do. Maybe they should be "Unsupported but parsed options" instead?

@hans they are ignored because Clang behaves like MSVC with these options
enabled (C++ standard conformance mode)

hans added a comment.Nov 5 2020, 8:54 AM

@hans they are ignored because Clang behaves like MSVC with these options
enabled (C++ standard conformance mode)

Ah, I got it backwards. Yeah, ignoring these makes sense.

Can you add the variants with trailing dash (e.g. /Zc:externConstexpr-) as parsed but unsupported?