Debian Codegraph @

gcc/testsuite/g++.dg/cpp0x/Wunused-value1.C

raw
1 // PR c++/90881
2 // { dg-do compile { target c++11 } }
3 // { dg-options "-Wall" }
4
5 namespace std {
6 struct true_type { static const bool value = true; };
7 struct false_type { static const bool value = false; };
8 }
9
10 template <typename T, typename = void> struct status : std::false_type{};
11
12 template <typename T> struct status<T, decltype(T::member, void())> : std::true_type {}; // { dg-bogus "left operand of comma operator has no effect" }
13
14 struct s1{int member;};
15 struct s2{int _member;};
16
17 int main(){
18 static_assert(status<s1>::value, "has member");
19 static_assert(!status<s2>::value, "has no member");
20 }