1 // Bug c++/83871 - wrong code due to attributes on distinct template
3 // Test to verify that an explicit function template specifialization
4 // does not "inherit" attribute nonnull from an argument declared with
5 // one in the primary template.
7 // { dg-options "-O -Wall -fdump-tree-optimized" }
10 void* __attribute__ ((returns_nonnull))
17 extern void g_void_returns_nonnull ();
18 extern void g_int_may_return_null ();
20 void test_returns_nonnull ()
24 g_void_returns_nonnull ();
29 void test_may_return_null ()
33 g_int_may_return_null ();
39 // Verify that the call to g_void_returns_nonnull() is eliminated but
40 // the call to g_int_may_return_null() is retained.
41 // { dg-final { scan-tree-dump-not "g_void_returns_nonnull" "optimized" } }
42 // { dg-final { scan-tree-dump-times "g_int_may_return_null" 1 "optimized" } }