Closed
Description
Title: template
in front of qualified-id instead of unqualified-id in UFCS.
Minimal reproducer (https://cpp2.godbolt.org/z/fTM758bhW):
main: () = {
_ = std::views::iota(0, 42).std::ranges::to<std::vector>();
}
Commands:
cppfront main.cpp2
clang++18 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -Werror=unused-result -Werror=unused-value -Werror=unused-parameter -I . main.cpp
Expected result:
Cpp1 std::views::iota(0, 42).std::ranges::template to<std::vector>()
(https://cpp1.godbolt.org/z/G44hKecs5).
Actual result and error:
Cpp1 std::views::iota(0, 42).template std::ranges::to<std::vector>()
(https://cpp1.godbolt.org/z/s5fWYbxdP).
Cpp2 lowered to Cpp1:
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
#line 1 "/app/example.cpp2"
//=== Cpp2 type definitions and function declarations ===========================
#line 1 "/app/example.cpp2"
auto main() -> int;
//=== Cpp2 function definitions =================================================
#line 1 "/app/example.cpp2"
auto main() -> int{
#line 2 "/app/example.cpp2"
static_cast<void>(CPP2_UFCS_TEMPLATE_0(std::ranges::to, (<std::vector>), std::views::iota(0, 42)));
}
Output:
main.cpp2:2:45: error: expected ';' at end of requirement
2 | static_cast<void>(CPP2_UFCS_TEMPLATE_0(std::ranges::to, (<std::vector>), std::views::iota(0, 42)));
| ^
main.cpp2:2:45: error: expected ';' after return statement
main.cpp2:2:55: error: no member named 'to' in namespace 'std::ranges'
2 | static_cast<void>(CPP2_UFCS_TEMPLATE_0(std::ranges::to, (<std::vector>), std::views::iota(0, 42)));
| ~~~~~~~~~~~~~^
raw.githubusercontent.com/hsutter/cppfront/main/include/cpp2util.h:816:16: note: expanded from macro 'CPP2_UFCS_TEMPLATE_0'
816 | return FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (CPP2_FORWARD(obj)); \
| ^~~~~~~~
main.cpp2:2:72: error: expected '(' for function-style cast or type construction
2 | static_cast<void>(CPP2_UFCS_TEMPLATE_0(std::ranges::to, (<std::vector>), std::views::iota(0, 42)));
| ~~~~~~~~~~~^
raw.githubusercontent.com/hsutter/cppfront/main/include/cpp2util.h:816:45: note: expanded from macro 'CPP2_UFCS_TEMPLATE_0'
816 | return FUNCNAME CPP2_UFCS_REMPARENS TEMPARGS (CPP2_FORWARD(obj)); \
| ^~~~~~~~
raw.githubusercontent.com/hsutter/cppfront/main/include/cpp2util.h:800:34: note: expanded from macro 'CPP2_UFCS_REMPARENS'
800 | #define CPP2_UFCS_REMPARENS(...) __VA_ARGS__
| ^~~~~~~~~~~
main.cpp2:2:81: error: no member named 'views' in namespace 'std'
2 | static_cast<void>(CPP2_UFCS_TEMPLATE_0(std::ranges::to, (<std::vector>), std::views::iota(0, 42)));
| ~~~~~^
raw.githubusercontent.com/hsutter/cppfront/main/include/cpp2util.h:818:3: note: expanded from macro 'CPP2_UFCS_TEMPLATE_0'
818 | }(PARAM1)
| ^~~~~~
5 errors generated.