annotate gcc/testsuite/g++.dg/warn/Wconversion-pr91993.C @ 19:2b5abeee2509 default tip

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
1 // PR c++/91993
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
2 // { dg-do compile }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
3 // { dg-options "-Wconversion" }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
4
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
5 typedef unsigned char uc;
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
6
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
7 int
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
8 foo (const uc &a, const uc &b, const uc &c)
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
9 {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
10 return static_cast<uc>(static_cast<uc>(a << 1U) | b) | c; // { dg-bogus "conversion from 'int' to 'unsigned char' may change value" }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
11 }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
12
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
13 int
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
14 bar (const uc &a, const uc &b, const uc &c, int &d)
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
15 {
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
16 return static_cast<uc>(static_cast<uc>((d++, a) << 1U) | b) | c; // { dg-bogus "conversion from 'int' to 'unsigned char' may change value" }
2b5abeee2509 update gcc11
anatofuz
parents:
diff changeset
17 }