[LLVMbugs] [Bug 19192] New: std::array is unable to be brace-initialized/universally initialized

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Mar 19 09:51:30 PDT 2014


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

            Bug ID: 19192
           Summary: std::array is unable to be
                    brace-initialized/universally initialized
           Product: libc++
           Version: 3.3
          Hardware: Macintosh
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: mjbshaw at hotmail.com
                CC: llvmbugs at cs.uiuc.edu, mclow.lists at gmail.com
    Classification: Unclassified

After a Q&A on StackOverflow[1], it seems there is a bug in libc++ (though I
suppose it could be in the clang front end instead of libc++; I'm assuming
libc++) that prevents std::array from being brace-initialized. Consider the
following:

std::array<int, 2> a = {1, 2};
std::array<int, 2> b{a}; // error: no viable conversion from 'std::array<int,
2>' to 'value_type' (aka 'int')
std::array<int, 2> b(a); // works

b{a} is trying to initialize b by creating an initializer list with a in it, as
opposed to using brace/universal initialization (which would be equivalent to
b(a), which works as expected).


[1]:
http://stackoverflow.com/questions/22495624/why-does-this-compile-with-visual-studio-2013-but-not-g-4-8-1

-- 
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/20140319/f1f1f4f6/attachment.html>


More information about the llvm-bugs mailing list