[llvm-bugs] [Bug 26880] New: Misleading error: array initializer must be an initializer list (when initializing an array with an initializer list)

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 8 08:20:48 PST 2016


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

            Bug ID: 26880
           Summary: Misleading error: array initializer must be an
                    initializer list (when initializing an array with an
                    initializer list)
           Product: clang
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: gonzalobg88 at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The following snippet:

struct Foo
  {
    int const data[2];

    Foo(std::initializer_list<int const>& ini)
    : data(ini)
    {}
  };

Foo f = {1,3};

Gives as error:

error: array initializer must be an initializer list

    : data(ini)
    ^

But the array initializer _is_ an initializer list. Every time I hit this I am
puzzled for half I minute till I recall "oh wait, there was something weird
about this".

-- 
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/20160308/ff7d8985/attachment.html>


More information about the llvm-bugs mailing list