[llvm-bugs] [Bug 45779] New: Fold expression using comma gives unnecessary warning
via llvm-bugs
llvm-bugs at lists.llvm.org
Sat May 2 15:40:56 PDT 2020
https://bugs.llvm.org/show_bug.cgi?id=45779
Bug ID: 45779
Summary: Fold expression using comma gives unnecessary warning
Product: clang
Version: trunk
Hardware: PC
OS: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++17
Assignee: unassignedclangbugs at nondot.org
Reporter: pkeir at outlook.com
CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk
Created attachment 23435
--> https://bugs.llvm.org/attachment.cgi?id=23435&action=edit
The file containing the code described.
Compiling the attached C++17 file (code also below) produces two warnings,
indicating that the result of the fold expression is unused. The result is
used.
template <typename ...Ts>
auto last(Ts ...xs) { return (xs , ...); }
int main(int argc, char *argv[])
{
int a = 0, b = 1, c = 2;
return last(a,b,c);
}
The warning messages are:
clang++ -std=c++17 comma-fold.cpp
comma-fold.cpp:2:31: warning: expression result unused [-Wunused-value]
auto last(Ts ...xs) { return (xs , ...); }
^~
comma-fold.cpp:7:10: note: in instantiation of function template specialization
'last<int, int, int>' requested here
return last(a,b,c);
^
comma-fold.cpp:2:31: warning: expression result unused [-Wunused-value]
auto last(Ts ...xs) { return (xs , ...); }
^~
2 warnings generated.
--
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200502/d2dba640/attachment.html>
More information about the llvm-bugs
mailing list