Mercurial > hg > CbC > CbC_gcc
view gcc/testsuite/g++.dg/ext/attr-nothrow.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | |
children |
line wrap: on
line source
// Bug c++/83871 - wrong code due to attributes on distinct template // specializations // Test to verify that an explicit template specifialization does not // "inherit" attribute nothrow from a primary template declared with one. // { dg-do compile } // { dg-options "-O -Wall -fdump-tree-optimized" } template <class T> void __attribute__ ((nothrow)) f (); template <> void f<int>(); void f_void_nothrow (); void f_int_maythrow (); void fv (void) { try { f<void>(); } catch (...) // cannot be be reached { f_void_nothrow (); // should be eliminated } } void fi (void) { try { f<int>(); } catch (...) // may be reached { f_int_maythrow (); // must not be eliminated } } // Verify that the call to f_void_nothrow() is eliminated but // the call to f_int_maythrow() is retained. // { dg-final { scan-tree-dump-not "f_void_nothrow" "optimized" } } // { dg-final { scan-tree-dump-times "f_int_maythrow" 1 "optimized" } }