[LLVMbugs] [Bug 24006] New: don't see a warning about unitialized const variable

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jul 1 07:53:01 PDT 2015


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

            Bug ID: 24006
           Summary: don't see a warning about unitialized const variable
           Product: clang
           Version: 3.4
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ppax13 at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Actual (std::string is const):
>cat no-warn.cpp
#include <string>
int main(void) { const std::string s = s; }

>clang++ -c -Wall -Wpedantic no-warn.cpp
// No warnings here

Expected (std::string is not const):

>cat warn.cpp 
#include <string>
int main(void) { std::string s = s; }

> clang++ -c warn.cpp 
warn.cpp:2:34: warning: variable 's' is uninitialized when used within its own
initialization [-Wuninitialized]
int main(void) { std::string s = s; }
                             ~   ^
1 warning 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/20150701/e12e03a6/attachment.html>


More information about the llvm-bugs mailing list