diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/cpp0x/noexcept09.C')
-rw-r--r-- | gcc/testsuite/g++.dg/cpp0x/noexcept09.C | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept09.C b/gcc/testsuite/g++.dg/cpp0x/noexcept09.C new file mode 100644 index 000000000..2a4525cbd --- /dev/null +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept09.C @@ -0,0 +1,14 @@ +// Test that -Wnoexcept works with templates +// { dg-options "-std=c++0x -Wnoexcept" } + +template <class T> +T f (T t) { return t; } // { dg-warning "does not throw" } + +#define SA(X) static_assert(X, #X) + +SA (!noexcept(f(1))); // { dg-warning "noexcept" } + +int main() +{ + f(1); // Use f(int) so it gets instantiated +} |