1 // Test that -Wnoexcept works with templates 2 // { dg-do compile { target c++11 } } 3 // { dg-options "-Wnoexcept" } 4 5 template <class T> f(T t)6T f (T t) { return t; } // { dg-message "does not throw" } 7 8 #define SA(X) static_assert(X, #X) 9 10 SA (!noexcept(f(1))); // { dg-warning "noexcept" } 11 main()12int main() 13 { 14 f(1); // Use f(int) so it gets instantiated 15 } 16