/* PR c++/84294 - attributes on a function template redeclaration silently discarded { dg-do compile } { dg-options "-O -fdump-tree-eh -fdump-tree-optimized" } */ typedef void Func (); template void fail_func () throw (); template void test_func () throw () { try { test (); } catch (...) { // Should be eliminated. fail_func (); } } void __attribute__ ((nothrow)) func_nothrow_none (); void func_nothrow_none (); template void test_func(); void func_none_nothrow (); void __attribute__ ((nothrow)) func_none_nothrow (); template void test_func(); template void __attribute__ ((nothrow)) templ_nothrow_none (); template void templa_nothrow_none (); template void test_func >(); template void templ_none_nothrow (); template void __attribute__ ((nothrow)) templ_none_nothrow (); template void test_func >(); // Verify that no exception handling code was emitted. // { dg-final { scan-tree-dump-not "eh_dispatch" "eh" } } // { dg-final { scan-tree-dump-not "resx" "eh" } } // Verify that calls to fail_func() specializations have been eliminated. // { dg-final { scan-tree-dump-not "fail_func" "optimized" } }