[PATCH] D98904: Instantiate static constexpr data members on MS ABI.

2021-03-18 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver added a comment. > So. I think the status quo is OK but not great; we accept invalid code, in > the name of MSVC compatibility, that MSVC doesn't accept. I don't think > following MSVC would be a good thing, as that'd lead to our rejecting valid > code (that MSVC also rejects but

[PATCH] D98904: Instantiate static constexpr data members on MS ABI.

2021-03-18 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D98904#2636109 , @zoecarver wrote: > I think we'd basically need a condition that says: `is-microsoft && > less-than-cxx17 && is-constexpr && is-static-data-member`. Yes. Looking back over the history a bit here,

[PATCH] D98904: Instantiate static constexpr data members on MS ABI.

2021-03-18 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver added a comment. > (I think you're missing something here to trigger the instantiation of the > class, such as Invalid x;.) Yes, you're right. > The above example is valid in C++17 onwards, because in C++17 onwards, static > constexpr data members are implicitly inline, and the

[PATCH] D98904: Instantiate static constexpr data members on MS ABI.

2021-03-18 Thread Richard Smith - zygoloid via Phabricator via cfe-commits
rsmith added a comment. In D98904#2636021 , @zoecarver wrote: > So, as I mentioned in the description of this patch, the reason that these > members are treated as definitions is that Clang implicitly marks them as > inline when targeting MS. This is

[PATCH] D98904: Instantiate static constexpr data members on MS ABI.

2021-03-18 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver added a comment. So, as I mentioned in the description of this patch, the reason that these members are treated as definitions is that Clang implicitly marks them as inline when targeting MS. This is sort of interesting a) because it only applies to constexpr vars, and b) because

[PATCH] D98904: Instantiate static constexpr data members on MS ABI.

2021-03-18 Thread Zoe Carver via Phabricator via cfe-commits
zoecarver created this revision. zoecarver added a reviewer: rsmith. zoecarver requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. Because MSVC will not treat the definition of a static data member as part of the declaration, it will not get