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: unassignedclangb...@nondot.org
          Reporter: jordan_r...@apple.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to