Closed
Description
Title: Argument list parentheses kept in non-local initialization.
Minimal reproducer (https://cpp2.godbolt.org/z/7Gcvzzov8):
u: type == std::array<i32, 2>;
t: @struct type = {
this: std::integral_constant<u, :u = (17, 29)>;
}
main: () = _ = :u = (17, 29);;
Commands:
cppfront main.cpp2
clang++17 -std=c++23 -stdlib=libc++ -lc++abi -pedantic-errors -Wall -Wextra -Wconversion -fsanitize=undefined -Werror=unused-result -I . main.cpp
Expected result: No warnings; same as the u
in main
.
Actual result and error:
Cpp2 lowered to Cpp1:
//=== Cpp2 type declarations ====================================================
#include "cpp2util.h"
class t;
//=== Cpp2 type definitions and function declarations ===========================
using u = std::array<cpp2::i32,2>;
class t: public std::integral_constant<u,u{(17, 29)}> {
};
auto main() -> int;
//=== Cpp2 function definitions =================================================
auto main() -> int { static_cast<void>(u{17, 29}); }
main.cpp2:2:45: warning: left operand of comma operator has no effect [-Wunused-value]
2 | class t: public std::integral_constant<u,u{(17, 29)}> {
| ^~
1 warning generated.