[PR c++/84702] ICE with default tmpl arg of overload set
[official-gcc.git] / gcc / testsuite / g++.dg / Wattributes-2.C
blob1470b16c567b16ea0070f82129b104078fb8347f
1 // Test to verify that attributes on distinct overloads of a function
2 //  with the same name are properly looked up and applied.
3 // { dg-do compile }
4 // { dg-options "-Wall" }
6 int
7 foo (int);
9 int __attribute__ ((noreturn))
10 foo (int, int);
12 int __attribute__ ((warn_unused_result))
13 foo (int, int, int);
15 int call_foo_1 ()
17   foo (1);
18 }                       // { dg-warning "\\\[-Wreturn-type]" }
20 int call_foo_2 ()
22   foo (1, 2);
25 int call_foo_3 ()
27   foo (1, 2, 3);        // { dg-warning "\\\[-Wunused-result]" }
28 }                       // { dg-warning "\\\[-Wreturn-type]" }
30 int call_foo_4 ()
32   // Make sure an error doesn't trigger bogus warnings or an ICE.
33   foo (1, 2, 3, 4);     // { dg-error "no matching function" }
34   return 0;