fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. template <class, class=void> struct is_complete : std::false_type {};
  5. template <class T>
  6. struct is_complete<T, decltype(void(sizeof(T)))> : std::true_type {};
  7.  
  8. struct A;
  9. struct Foo {};
  10. int main() {
  11.  
  12. is_complete<Foo>::value;
  13. static_assert(is_complete<Foo>::value, "Type is not defined!");
  14.  
  15. is_complete<A>::value;
  16.  
  17. return 0;
  18. }
  19.  
  20. struct A
  21. {
  22.  
  23. };
  24.  
  25.  
  26. void func()
  27. {
  28. static_assert(is_complete<A>::value, "Type is not defined!");
  29. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function 'void func()':
prog.cpp:28:2: error: static assertion failed: Type is not defined!
  static_assert(is_complete<A>::value, "Type is not defined!");
  ^
stdout
Standard output is empty