forked from hsutter/cppfront
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
120 changed files
with
1,697 additions
and
595 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* text=auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Multi-platform Build of cppfront | ||
on: push | ||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: ilammy/msvc-dev-cmd@v1 | ||
- name: Compiler name & version | ||
run: cl.exe | ||
- name: Build | ||
run: cl.exe source/cppfront.cpp -std:c++latest -MD -EHsc -experimental:module -W4 | ||
build-unix-like: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
runs-on: [ubuntu-latest] | ||
compiler: [g++-10, g++-11, g++-12, clang++-12, clang++-14] | ||
cxx-std: ['c++20', 'c++2b'] | ||
exclude: | ||
# GCC 10 doesn't have support for c++23 | ||
- compiler: g++-10 | ||
cxx-std: 'c++2b' | ||
# Clang 12 and 14 do not compile on 'c++2b' due to llvm/llvm-project#58206 | ||
- compiler: clang++-12 | ||
cxx-std: 'c++2b' | ||
- compiler: clang++-14 | ||
cxx-std: 'c++2b' | ||
include: | ||
- runs-on: macos-11 | ||
compiler: clang++ | ||
cxx-std: 'c++20' | ||
- runs-on: macos-latest | ||
compiler: clang++ | ||
cxx-std: 'c++20' | ||
runs-on: ${{ matrix.runs-on }} | ||
env: | ||
CXX: ${{ matrix.compiler }} | ||
CXXFLAGS: -std=${{ matrix.cxx-std }} -Wall -Wextra -Wold-style-cast -pthread | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install compiler | ||
if: startsWith(matrix.runs-on, 'ubuntu') | ||
run: sudo apt-get install -y $CXX | ||
- name: Compiler name & version | ||
run: $CXX --version | ||
- name: Build | ||
run: $CXX source/cppfront.cpp $CXXFLAGS -o cppfront |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
|
||
iterator: @value <T> type = { | ||
public x: T = 0; | ||
operator++: (inout this) -> forward iterator<T> requires true = { x++; return this; } | ||
} | ||
|
||
iterator2: @value <T> type = { | ||
public x: T = 0; | ||
} | ||
operator++: <T> (inout it: iterator2<T>) -> forward iterator2<T> requires true = { it.x++; return it; } | ||
|
||
int main() { | ||
{ | ||
iterator<int> i; | ||
std::cout << (++i).x; | ||
std::cout << (++i).x; | ||
std::cout << i++.x; | ||
std::cout << i++.x; | ||
std::cout << i.x << "\n"; | ||
} | ||
|
||
{ | ||
iterator2<int> i; | ||
std::cout << (++i).x; | ||
std::cout << (++i).x; | ||
std::cout << i++.x; | ||
std::cout << i++.x; | ||
std::cout << i.x << "\n"; | ||
} | ||
} | ||
|
||
|
||
|
||
number: @struct type = { | ||
operator<=>: (this, that) -> _; | ||
operator-: (this, _) -> int = 0; | ||
} | ||
|
||
number_line: @struct <Op: i8, Id: i32> type = { | ||
this: number; | ||
} | ||
|
||
number_line_pre_increment: <Id: i32> type == number_line<0b1110, Id>; | ||
number_line_pre_decrement: <Id: i32> type == number_line<0b1101, Id>; | ||
number_line_post_increment: <Id: i32> type == number_line<0b1011, Id>; | ||
number_line_post_decrement: <Id: i32> type == number_line<0b0111, Id>; | ||
|
||
operator++: <Op: i8, Id: i32> (inout x: number_line<Op, Id>) -> forward number_line<Op, Id> requires bool(Op & 1) = x; | ||
operator--: <Op: i8, Id: i32> (inout x: number_line<Op, Id>) -> forward number_line<Op, Id> requires bool(Op & 2) = x; | ||
|
||
operator++: (inout x: number_line_pre_increment<0>) -> forward number_line_pre_increment<0> = x; | ||
operator--: (inout x: number_line_pre_decrement<0>) -> forward number_line_pre_decrement<0> = x; | ||
|
||
operator++: (inout x: number_line_pre_increment<1>) -> forward const number_line_pre_increment<1> = x; | ||
operator--: (inout x: number_line_pre_decrement<1>) -> forward const number_line_pre_decrement<1> = x; |
15 changes: 15 additions & 0 deletions
15
regression-tests/pure2-bugfix-for-unbraced-function-expression.cpp2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
t: type = { | ||
operator[]: (this, _) = { } | ||
} | ||
|
||
main: () -> int = { | ||
(x := t()) { x[:() -> _ = 0]; } | ||
(x := t()) { x[:() -> _ = 0;]; } | ||
|
||
assert(!(:() 0; is int)); | ||
|
||
return :i32 = 0; | ||
} | ||
|
||
x :== :i32 = 0; | ||
y: i32 = 0; |
Oops, something went wrong.