131
|
1 /* PR c++/83871 - wrong code for attribute const and pure on distinct
|
|
2 template specializations
|
|
3 { dg-do compile }
|
|
4 { dg-options "-O1 -Wall -fdump-tree-optimized" } */
|
|
5
|
|
6 int __attribute__ ((const)) fconst_none ();
|
|
7 int fconst_none ();
|
|
8
|
|
9 void func_const_none_failed ();
|
|
10
|
|
11 void func_const_none ()
|
|
12 {
|
|
13 int i0 = fconst_none ();
|
|
14 int i1 = fconst_none ();
|
|
15 if (i0 != i1)
|
|
16 func_const_none_failed ();
|
|
17
|
|
18 // { dg-final { scan-tree-dump-not "func_const_none_failed" "optimized" } }
|
|
19 }
|
|
20
|
|
21
|
|
22 int fnone_const ();
|
|
23 int __attribute__ ((const)) fnone_const ();
|
|
24
|
|
25 void func_none_const_failed ();
|
|
26
|
|
27 void func_none_const ()
|
|
28 {
|
|
29 int i0 = fnone_const ();
|
|
30 int i1 = fnone_const ();
|
|
31 if (i0 != i1)
|
|
32 func_none_const_failed ();
|
|
33
|
|
34 // { dg-final { scan-tree-dump-not "func_none_const_failed" "optimized" } }
|
|
35 }
|
|
36
|
|
37 template <class T>
|
|
38 int __attribute__ ((const)) fconst_none (T);
|
|
39
|
|
40 template <class T>
|
|
41 int fconst_none (T);
|
|
42
|
|
43 void templ_const_none_failed ();
|
|
44
|
|
45 void template_const_none ()
|
|
46 {
|
|
47 int i0 = fconst_none<int> (0);
|
|
48 int i1 = fconst_none<int> (0);
|
|
49 if (i0 != i1)
|
|
50 templ_const_none_failed ();
|
|
51
|
|
52 // { dg-final { scan-tree-dump-not "templ_const_none_failed" "optimized" } }
|
|
53 }
|
|
54
|
|
55
|
|
56 template <class T>
|
|
57 int fnone_const (T);
|
|
58
|
|
59 template <class T>
|
|
60 int __attribute__ ((const)) fnone_const (T);
|
|
61
|
|
62 void templ_none_const_failed ();
|
|
63
|
|
64 void test_fnone_const ()
|
|
65 {
|
|
66 int i0 = fnone_const<int> (0);
|
|
67 int i1 = fnone_const<int> (0);
|
|
68 if (i0 != i1)
|
|
69 templ_none_const_failed ();
|
|
70
|
|
71 // { dg-final { scan-tree-dump-not "templ_none_const_failed" "optimized" } }
|
|
72 }
|