fork(2) download
  1. #include <cstdint>
  2. #include <type_traits>
  3.  
  4. struct chameleon
  5. {
  6. template<typename T>
  7. constexpr operator T() const
  8. {
  9. return T{};
  10. }
  11.  
  12. constexpr chameleon() = default;
  13. };
  14.  
  15. template<std::size_t I>
  16. struct placeholder : public chameleon
  17. {
  18. using chameleon::chameleon;
  19. };
  20.  
  21. constexpr const placeholder<0> _1;
  22.  
  23. using t = std::integral_constant<int,_1>;
  24.  
  25. int main()
  26. {
  27.  
  28.  
  29. return 0;
  30. }
  31.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:23:38: error: the value of ‘_1’ is not usable in a constant expression
 using t = std::integral_constant<int,_1>;
                                      ^
prog.cpp:21:32: note: ‘_1’ used in its own initializer
 constexpr const placeholder<0> _1;
                                ^
stdout
Standard output is empty