Skip to content

[BUG] Not emitting Cpp2 space changes Cpp1 parsing due to max munch #524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
JohelEGP opened this issue Jun 22, 2023 · 0 comments · Fixed by #617
Closed

[BUG] Not emitting Cpp2 space changes Cpp1 parsing due to max munch #524

JohelEGP opened this issue Jun 22, 2023 · 0 comments · Fixed by #617
Labels
bug Something isn't working

Comments

@JohelEGP
Copy link
Contributor

Title: Not emitting Cpp2 space changes Cpp1 parsing due to max munch.

Minimal reproducer (https://cpp2.godbolt.org/z/Kej4Kr1na):

v: <T> == 0;
main: () = v<i32> == v<i32>;
Commands:
cppfront main.cpp2
clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -I . main.cpp

Expected result:

auto main() -> int { v<cpp2::i32> == v<cpp2::i32>;  }

Actual result and error:

auto main() -> int { v<cpp2::i32>==v<cpp2::i32>;  }
Cpp2 lowered to Cpp1:
//=== Cpp2 type declarations ====================================================


#include "cpp2util.h"



//=== Cpp2 type definitions and function declarations ===========================

template<typename T> auto const& v = 0;
auto main() -> int;


//=== Cpp2 function definitions =================================================


auto main() -> int { v<cpp2::i32>==v<cpp2::i32>;  }
Output:
main.cpp2:2:33: error: a space is required between a right angle bracket and an equals sign (use '> =')
    2 | auto main() -> int { v<cpp2::i32>==v<cpp2::i32>;  }
      |                                 ^~
      |                                 > =
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant