Skip to content

Commit 4900c6c

Browse files
committed
test: add unit test for recursion during lookup
1 parent b84312e commit 4900c6c

4 files changed

+45
-0
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
main: () = {
2+
a: type == b;
3+
b: type == a;
4+
_ = a::t;
5+
_ = b::t;
6+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
/home/johel/tmp/cppfront/GCCDebug/regression-tests/pure2-bugfix-for-dependent-types-recursion/build/_cppfront/pure2-bugfix-for-dependent-types-recursion.cpp: In function ‘int main()’:
2+
/home/johel/tmp/cppfront/GCCDebug/regression-tests/pure2-bugfix-for-dependent-types-recursion/build/_cppfront/pure2-bugfix-for-dependent-types-recursion.cpp:19:13: error: ‘b’ does not name a type
3+
19 | using a = b;
4+
| ^
5+
/home/johel/tmp/cppfront/GCCDebug/regression-tests/pure2-bugfix-for-dependent-types-recursion/build/_cppfront/pure2-bugfix-for-dependent-types-recursion.cpp:20:13: error: ‘a’ does not name a type
6+
20 | using b = a;
7+
| ^
8+
/home/johel/tmp/cppfront/GCCDebug/regression-tests/pure2-bugfix-for-dependent-types-recursion/build/_cppfront/pure2-bugfix-for-dependent-types-recursion.cpp:21:21: error: ‘a’ has not been declared
9+
21 | static_cast<void>(a::t);
10+
| ^
11+
/home/johel/tmp/cppfront/GCCDebug/regression-tests/pure2-bugfix-for-dependent-types-recursion/build/_cppfront/pure2-bugfix-for-dependent-types-recursion.cpp:22:21: error: ‘b’ has not been declared
12+
22 | static_cast<void>(b::t);
13+
| ^
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
#define CPP2_IMPORT_STD Yes
3+
4+
//=== Cpp2 type declarations ====================================================
5+
6+
7+
#include "cpp2util.h"
8+
9+
10+
11+
//=== Cpp2 type definitions and function declarations ===========================
12+
13+
auto main() -> int;
14+
15+
16+
//=== Cpp2 function definitions =================================================
17+
18+
auto main() -> int{
19+
using a = b;
20+
using b = a;
21+
static_cast<void>(a::t);
22+
static_cast<void>(b::t);
23+
}
24+
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pure2-bugfix-for-dependent-types-recursion.cpp2... ok (all Cpp2, passes safety checks)
2+

0 commit comments

Comments
 (0)