[llvm-bugs] [Bug 42072] New: [[nodiscard]] should work on constructors

via llvm-bugs llvm-bugs at lists.llvm.org
Thu May 30 08:22:58 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42072

            Bug ID: 42072
           Summary: [[nodiscard]] should work on constructors
           Product: clang
           Version: unspecified
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: jordan_rose at apple.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

C++20 says nothing about the behavior of [[nodiscard]] on a constructor; it
would be useful for that to result in a warning for RAII temporaries:

PrettyStackTraceString("oops"); // warning
PrettyStackTraceString stackTraceRAII("okay"); // no warning

(I suppose this behavior would also apply to [[nodiscard]] on the entire class,
which it currently doesn't.)

-- 
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/20190530/f5c427af/attachment.html>


More information about the llvm-bugs mailing list