Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/warn/noeffect4.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 // { dg-do compile } | |
2 // { dg-options "-Wall" } | |
3 | |
4 // Copyright (C) 2003 Free Software Foundation, Inc. | |
5 // Contributed by Nathan Sidwell 2 Sep 2003 <nathan@codesourcery.com> | |
6 | |
7 // PR 12037. | |
8 | |
9 struct X | |
10 { | |
11 int operator+(int); | |
12 int operator-(int); | |
13 int operator*(int); | |
14 int operator/(int); | |
15 int operator%(int); | |
16 int operator>>(int); | |
17 int operator<<(int); | |
18 int operator&(int); | |
19 int operator|(int); | |
20 int operator^(int); | |
21 int operator&&(int); | |
22 int operator||(int); | |
23 int operator==(int); | |
24 int operator!=(int); | |
25 int operator<(int); | |
26 int operator<=(int); | |
27 int operator>(int); | |
28 int operator>=(int); | |
29 int operator*(); | |
30 int operator!(); | |
31 int operator~(); | |
32 int operator++(); | |
33 int operator--(); | |
34 int operator++(int); | |
35 int operator--(int); | |
36 int operator()(); | |
37 int operator,(int); | |
38 X *operator->(); | |
39 operator int () const; | |
40 int m; | |
41 virtual ~X (); | |
42 X &Foo (); | |
43 }; | |
44 struct Y : X | |
45 { | |
46 }; | |
47 | |
48 template<int I> void Foo (X &x) | |
49 { | |
50 x + I; | |
51 x - I; | |
52 x * I; | |
53 x / I; | |
54 x % I; | |
55 x >> I; | |
56 x << I; | |
57 x & I; | |
58 x | I; | |
59 x && I; | |
60 x || I; | |
61 x == I; | |
62 x != I; | |
63 x < I; | |
64 x <= I; | |
65 x > I; | |
66 x >= I; | |
67 *x; | |
68 !x; | |
69 ~x; | |
70 x++; | |
71 x--; | |
72 ++x; | |
73 --x; | |
74 x (); | |
75 x, I; | |
76 x->m; | |
77 static_cast<int> (x); | |
78 dynamic_cast<Y &> (x); | |
79 reinterpret_cast<int> (x.Foo ()); // { dg-error "invalid cast" } | |
80 const_cast<X &> (x.Foo ()); // { dg-warning "not used" } | |
81 | |
82 reinterpret_cast<int *> (&x);// { dg-warning "no effect" } | |
83 const_cast<X &> (x); // { dg-warning "no effect" } | |
84 sizeof (x++); // { dg-warning "no effect" } | |
85 __alignof__ (x++); // { dg-warning "no effect" } | |
86 } | |
87 | |
88 template void Foo<4> (X&); // { dg-message "required" } |