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

            Bug ID: 38878
           Summary: Enhance "returning address of local var" checker
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangb...@nondot.org
          Reporter: david.bolvan...@gmail.com
                CC: dgre...@apple.com, llvm-bugs@lists.llvm.org

struct S&& po() {
    struct S tmp;
    return std::move(tmp);
}

No warning from Clang.

GCC warns:
<source>: In function 'S&& po()':
<source>:14:23: warning: function returns address of local variable
[-Wreturn-local-addr]
14 |     return std::move(tmp);
   |                       ^
<source>:13:14: note: declared here
13 |     struct S tmp;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to