comparison gcc/testsuite/g++.dg/concepts/expression.C @ 145:1830386684a0

gcc-9.2.0
author anatofuz
date Thu, 13 Feb 2020 11:34:05 +0900
parents 84e7813d76e9
children
comparison
equal deleted inserted replaced
131:84e7813d76e9 145:1830386684a0
1 // { dg-do run { target c++17 } } 1 // { dg-do run { target c++17_only } }
2 // { dg-options "-fconcepts" } 2 // { dg-options "-fconcepts" }
3
4 // TODO: ICE on gimplify 16?
3 5
4 #include <cassert> 6 #include <cassert>
5 #include <iostream> 7 #include <iostream>
6 8
7 template<typename T> 9 template<typename T>
8 concept bool C1 = __is_class(T); 10 concept bool C1 = __is_class(T);
9 11
10 template<typename T> 12 template<typename T>
11 concept bool C2() { return __is_class(T); } 13 concept bool C3 = requires (T a) { ++a; };
12
13 template<typename T>
14 concept bool C3() { return requires (T a) { ++a; }; }
15 14
16 int main() { 15 int main() {
17 if (C1<int>) assert(false); 16 if (C1<int>) assert(false);
18 if (C2<int>()) assert(false); 17 if (!C3<int>) assert(false);
19 if (!C3<int>()) assert(false);
20 } 18 }