<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Sun, Sep 4, 2016 at 3:53 PM Sanjoy Das <<a href="mailto:sanjoy@playingwithpointers.com">sanjoy@playingwithpointers.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Chandler,<br>
<br>
Chandler Carruth wrote:<br>
 > My 2 cents: get rid of LLVM_UNUSED_RESULT, and move to LLVM_NODISCARD.<br>
 ><br>
 > For compilers that support it, it should be a strict superset of features and functionality. The standard feature was<br>
 > written directly based on the clang warn_unused_result stuff.<br>
<br>
Maybe I misunderstood something, but with clang 3.8.1 I cannot write:<br>
<br>
int [[clang::nodiscard]] f();<br>
<br>
so I'm not sure if LLVM_NODISCARD provides a superset of the functionality.<br></blockquote><div><br></div><div>I don't know anything about [[clang::nodiscard]], but I would expect <span style="line-height:1.5">[[clang::warn_unused_result]] in C++11 and C++14 to work in all the places and have the same effect as [[nodiscard]] does in C++17. Here is a recent clang build:</span></div><div><br></div><div>echo -e '[[nodiscard]] int f();\nstruct [[nodiscard]] X {};' | clang -fsyntax-only -x c++ -std=c++1z -<br></div><div>echo -e '[[clang::warn_unused_result]] int f();\nstruct [[clang::warn_unused_result]] X {};' | clang -fsyntax-only -x c++ -std=c++11 -<br></div><div><br></div><div>-Chandler</div></div></div>