Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/warn/Wsign-conversion-5.C @ 145:1830386684a0
gcc-9.2.0
author | anatofuz |
---|---|
date | Thu, 13 Feb 2020 11:34:05 +0900 |
parents | |
children |
rev | line source |
---|---|
145 | 1 // PR c++/87519 - bogus warning with -Wsign-conversion. |
2 // { dg-options "-Wsign-conversion" } | |
3 | |
4 typedef unsigned long int uint64_t; | |
5 | |
6 void f(unsigned long int a, int q) | |
7 { | |
8 a += a + q; // { dg-warning "may change the sign" } | |
9 | |
10 // Explicit cast should disable the warning. | |
11 a = a + static_cast<uint64_t>(q); | |
12 a = a + (uint64_t) q; | |
13 a = a + uint64_t(q); | |
14 a = a + static_cast<const uint64_t>(q); | |
15 a = a + (const uint64_t) q; | |
16 a = a + static_cast<unsigned long int>(q); | |
17 a = a + static_cast<const unsigned long int>(q); | |
18 } |