blob: 1b3538dceea120086cdbc0ec2a307bf70a4cd004 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// PR c++/67225
// { dg-do compile { target c++20 } }
// { dg-additional-options "-fconcepts" }
template<typename Target>
// template<typename Target, typename... Ts>
concept has_resize =
requires (Target tgt)
{
{ tgt.resize () };
};
template<typename Target>
void resize (Target tgt)
{
if constexpr (has_resize<Target>)
{
tgt.resize ();
}
}
class MyClass
{
private:
int foo (int i)
{
return i * 2;
}
};
int main ()
{
return MyClass {}.foo (7); // { dg-error "private within this context" }
}
|