[libcxx-commits] [PATCH] D58023: [libcxx] MSVC does not provide constexpr for typeid and typeid is probably not constexpr

Eric Fiselier via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Feb 10 22:30:17 PST 2019


EricWF requested changes to this revision.
EricWF added a comment.
This revision now requires changes to proceed.

MSVC is wrong and this code is well formed. Please file a bug with MSVC.
The wording is somewhere in [expr.const].

The value of the `typeid` object isn't usable in a constant expression, but the address of the `typeid` object is. Similarly.

  void test() {
    static int x = rand();
    constexpr int& y = x; // OK
   static_assert(&y); // OK
   static_assert(y); // BOOM!;
  }

The constexpr here is important to ensuring that the `__policy_` variable has a constant initializer and therefore doesn't need or emit a guard variable.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D58023/new/

https://reviews.llvm.org/D58023





More information about the libcxx-commits mailing list