This is an archive of the discontinued LLVM Phabricator instance.

[MS] Pretend constexpr variable template specializations are inline
ClosedPublic

Authored by rnk on Jun 11 2019, 4:32 PM.

Details

Summary

Fixes link errors with clang and the latest Visual C++ 14.21.27702
headers, which was reported as PR42027.

I chose to intentionally make these things linkonce_odr, i.e.
discardable, so that we don't emit definitions of these things in every
translation unit that includes STL headers.

Diff Detail

Repository
rL LLVM

Event Timeline

rnk created this revision.Jun 11 2019, 4:32 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 11 2019, 4:32 PM
rsmith accepted this revision.Jun 11 2019, 4:51 PM
rsmith added inline comments.
clang/lib/AST/ASTContext.cpp
9809 ↗(On Diff #204190)

It'd be nice to include a note here that this is strictly non-conforming (since another TU could be relying on this TU to provide the definition), but that we don't expect that to happen in practice for variable template specializations declared constexpr.

This revision is now accepted and ready to land.Jun 11 2019, 4:51 PM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJun 12 2019, 11:51 AM
rnk marked an inline comment as done.Jun 12 2019, 12:47 PM
rnk added inline comments.
clang/lib/AST/ASTContext.cpp
9809 ↗(On Diff #204190)

I forgot to add the comment before pushing, so I added it in rC363195.