This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/53361] New: Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: "roucaries.bastien+bugs at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 May 2012 14:57:24 +0000
- Subject: [Bug c++/53361] New: Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53361
Bug #: 53361
Summary: Could not convert â{0, 0, 0}â from â<brace-enclosed
initializer list>â to âstd::array<unsigned int, 3ul>â
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: roucaries.bastien+bugs@gmail.com
Fail to compile:
#include <array>
void function(std::array<unsigned int,3> a)
{
}
int main()
{
// ok
std::array<unsigned int,3> vec {0, 0, 0};
// error: could not convert '{"hello", "world", "test"}' to
'std::vector...'
function({0,0,0});
}
--------------------
8.5/14,16:
The initialization that occurs in the form
T x = a;
as well as in argument passing, function return, throwing an exception
(15.1), handling an exception (15.3), and aggregate member initialization
(8.5.1) is called copy-initialization.
.
.
The semantics of initializers are as follows[...]: If the initializer is a
braced-init-list, the object is list-initialized (8.5.4).
So it seems a bug.
bastien
- Follow-Ups:
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: pinskia at gcc dot gnu.org
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: paolo.carlini at oracle dot com
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: roucaries.bastien+bugs at gmail dot com
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: paolo.carlini at oracle dot com
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: paolo.carlini at oracle dot com
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: paolo at gcc dot gnu.org
- [Bug c++/53361] Could not convert â{0, 0, 0}â from â<brace-enclosed initializer list>â to âstd::array<unsigned int, 3ul>â
- From: paolo.carlini at oracle dot com