[LLVMbugs] [Bug 18117] New: -Wmissing-braces warning when initializing an array using a parameter pack

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Mon Dec 2 13:07:45 PST 2013


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

            Bug ID: 18117
           Summary: -Wmissing-braces warning when initializing an array
                    using a parameter pack
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++11
          Assignee: unassignedclangbugs at nondot.org
          Reporter: andersca at icloud.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

#include <array>
#include <tuple>

template<typename> struct Sizes;

template<typename ...Ts> struct Sizes<std::tuple<Ts...>> {
    static std::array<size_t, sizeof...(Ts)> sizes()
    {
        return { sizeof(Ts)... };
    }
};

size_t f(size_t i) {
    return Sizes<std::tuple<unsigned, bool>>::sizes()[i];
}

Anderss-MacBook-Pro:clang andersca$ clang -fsyntax-only -Wall t.cpp -std=c++11
t.cpp:9:18: warning: suggest braces around initialization of subobject
[-Wmissing-braces]
        return { sizeof(Ts)... };
                 ^~~~~~~~~~
                 {         }
t.cpp:14:47: note: in instantiation of member function
'Sizes<std::__1::tuple<unsigned int, bool> >::sizes' requested here
    return Sizes<std::tuple<unsigned, bool>>::sizes()[i];
                                              ^
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/20131202/1c06224e/attachment.html>


More information about the llvm-bugs mailing list