[LLVMbugs] [Bug 21629] New: Warning "missing braces around initializer" causing problems with std::array

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 21 02:20:16 PST 2014


http://llvm.org/bugs/show_bug.cgi?id=21629

            Bug ID: 21629
           Summary: Warning "missing braces around initializer" causing
                    problems with std::array
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: ehysta at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Similar bug as in GCC: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25137

It was resolved with "-Wmissing-braces will no longer be enabled in GCC's -Wall
(for C++ mode), as of 4.8, for precisely the reason you describe.".

Clang: http://coliru.stacked-crooked.com/a/784733e4c860f68e
GCC: http://coliru.stacked-crooked.com/a/5c58c123f2108df5

Code:
#include <array>

template<typename T, size_t N>
struct static_array
{
    T elems[N];
};

int main() {
    std::array<int, 3> a = {1,2,3}; // warning: suggest braces around
initialization of subobject
    static_array<int, 3> b = {1,2,3}; // same
    return 0;
}

-- 
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/20141121/53b8e0cd/attachment.html>


More information about the llvm-bugs mailing list