comparison gcc/testsuite/g++.dg/warn/Wconversion-pr91993.C @ 152:2b5abeee2509

update gcc11
author anatofuz
date Mon, 25 May 2020 07:50:57 +0900
parents
children
comparison
equal deleted inserted replaced
145:1830386684a0 152:2b5abeee2509
1 // PR c++/91993
2 // { dg-do compile }
3 // { dg-options "-Wconversion" }
4
5 typedef unsigned char uc;
6
7 int
8 foo (const uc &a, const uc &b, const uc &c)
9 {
10 return static_cast<uc>(static_cast<uc>(a << 1U) | b) | c; // { dg-bogus "conversion from 'int' to 'unsigned char' may change value" }
11 }
12
13 int
14 bar (const uc &a, const uc &b, const uc &c, int &d)
15 {
16 return static_cast<uc>(static_cast<uc>((d++, a) << 1U) | b) | c; // { dg-bogus "conversion from 'int' to 'unsigned char' may change value" }
17 }