Question Details

No question body available.

Tags

c++ c++26

Answers (1)

Accepted Answer Available
Accepted Answer
June 11, 2026 Score: 8 Rep: 47,924 Quality: High Completeness: 40%

bases cannot be set as a constexpr variable. However, this does not affect your calculation of the size of base, so this will work:

consteval auto func(std::meta::info type) {
  constexpr auto ctx = std::meta::accesscontext::unchecked();
  auto bases = basesof(type, ctx);
  return bases.size();
}

staticassert(func(^^std::exception) == 0); staticassert(func(^^std::meta::exception) == 1);