comparison gcc/testsuite/g++.dg/cpp0x/noexcept09.C @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 1830386684a0
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 // Test that -Wnoexcept works with templates
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wnoexcept" }
4
5 template <class T>
6 T f (T t) { return t; } // { dg-warning "does not throw" }
7
8 #define SA(X) static_assert(X, #X)
9
10 SA (!noexcept(f(1))); // { dg-warning "noexcept" }
11
12 int main()
13 {
14 f(1); // Use f(int) so it gets instantiated
15 }