Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wconversion5.C

raw
1 // PR c++/99331
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wconversion" }
4 // Don't issue -Wconversion warnings for value-dependent expressions.
5
6 template <int> struct X {};
7 template <signed char> struct Y {};
8 template <typename T> X<sizeof(T)> foo();
9 template <typename T> X<alignof(T)> foo2();
10 template<int I> Y<I> foo3();
11 template<int> Y<1024> foo4(); // { dg-error "narrowing conversion" }
12 template<int> Y<1u> foo5();
13 template<int> X<__INT_MAX__ + 1U> foo6(); // { dg-error "narrowing conversion" }
14
15 template <typename T>
16 struct S {
17 using t = X<sizeof(T)>;
18 using u = X<alignof(T)>;
19 };