Closed
Description
Title: Unused variable check only applies to a potentially movable local.
Minimal reproducer (https://cpp2.godbolt.org/z/jre1681ae):
f: (x) = { }
g: (copy y) = { }
main: () = { }
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 -Werror=unused-variable -I . main.cpp
Expected result: For x
to be diagnosed as unused.
Actual result and error: Only y
is diagnosed as unused.
main.cpp2...
main.cpp2(2,10): error: local variable y is not used; consider changing its name to '_' to make it explicitly anonymous, or removing it entirely if its side effects are not needed