Skip to content

Commit 742d56f

Browse files
committed
adding more tests
1 parent e354b73 commit 742d56f

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// { dg-do compile }
2+
// { dg-options "-std=c++23 -fcontracts -fcontracts-nonattr -fcontracts-nonattr-inheritance-mode=P2900R13 " }
3+
4+
struct NTClass {
5+
//TODO, make non trivial when https://github.com/NinaRanns/gcc/issues/21 is solved
6+
// NTClass(){};
7+
// ~NTClass(){};
8+
};
9+
10+
template <typename... ARGS>
11+
bool check(ARGS... args){ return true;}
12+
13+
14+
struct Base
15+
{
16+
virtual void f (const NTClass i);
17+
18+
} ;
19+
20+
struct Derived : Base
21+
{
22+
virtual void f (const NTClass i) post (check (i));
23+
};
24+
25+
struct DerivedV : virtual Base
26+
{
27+
virtual void f (const NTClass i) post (check (i));
28+
};
29+
30+
void
31+
Derived::f (NTClass i){} // { dg-error "used in a postcondition must be const" }
32+
33+
void
34+
DerivedV::f (NTClass i){} // { dg-error "used in a postcondition must be const" }
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
// { dg-do compile }
2+
// { dg-options "-std=c++23 -fcontracts -fcontracts-nonattr -fcontracts-nonattr-inheritance-mode=P3653 " }
3+
4+
struct NTClass {
5+
//TODO, make non trivial when https://github.com/NinaRanns/gcc/issues/21 is solved
6+
// NTClass(){};
7+
// ~NTClass(){};
8+
};
9+
10+
template <typename... ARGS>
11+
bool check(ARGS... args){ return true;}
12+
13+
14+
struct Base
15+
{
16+
virtual void f (const NTClass i);
17+
18+
} ;
19+
20+
struct Derived : Base
21+
{
22+
virtual void f (const NTClass i) post (check (i));
23+
};
24+
25+
struct DerivedV : virtual Base
26+
{
27+
virtual void f (const NTClass i) post (check (i));
28+
};
29+
30+
void
31+
Derived::f (NTClass i){} // { dg-error "used in a postcondition must be const" }
32+
33+
void
34+
DerivedV::f (NTClass i){} // { dg-error "used in a postcondition must be const" }

0 commit comments

Comments
 (0)