cxx-static_assert.cpp 481 B

123456789101112131415161718192021
  1. // Test this without pch.
  2. // RUN: %clang_cc1 -include %s -verify -std=c++11 %s
  3. // Test with pch.
  4. // RUN: %clang_cc1 -std=c++11 -emit-pch -o %t %s
  5. // RUN: %clang_cc1 -include-pch %t -verify -std=c++11 %s
  6. #ifndef HEADER
  7. #define HEADER
  8. template<int N> struct T {
  9. static_assert(N == 2, "N is not 2!");
  10. };
  11. #else
  12. // expected-error@12 {{static_assert failed "N is not 2!"}}
  13. T<1> t1; // expected-note {{in instantiation of template class 'T<1>' requested here}}
  14. T<2> t2;
  15. #endif