Bug 61484 - [C++11] can't initialize constexpr multi-dimentional array of a literal type
Summary: [C++11] can't initialize constexpr multi-dimentional array of a literal type
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: 5.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks: constexpr
  Show dependency treegraph
 
Reported: 2014-06-12 11:32 UTC by Vladimir Marko
Modified: 2014-08-29 08:44 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2014-06-26 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Marko 2014-06-12 11:32:11 UTC
Test case:

struct S {
  constexpr S() { }
};

constexpr S s[][1] = {
    { S() }
};

Bogus error:
test.cc:7:1: error: array must be initialized with a brace-enclosed initializer

Reproduced with gcc 4.6.3 on host (x86_64-linux-gnu) and gcc 4.8.0 from AOSP prebuilts (x86_64-linux-android).
Comment 1 Vladimir Marko 2014-06-12 13:43:45 UTC
Fails with gcc 4.9.0 from AOSP prebuilts (aarch64-linux-android).
Comment 2 Daniel Krügler 2014-06-13 21:39:31 UTC
The same error exists in 4.10.0 20140612 (experimental)
Comment 3 Paolo Carlini 2014-08-29 08:33:15 UTC
This works in current mainline, I'm adding the testcase and closing the bug.
Comment 4 paolo@gcc.gnu.org 2014-08-29 08:41:48 UTC
Author: paolo
Date: Fri Aug 29 08:41:16 2014
New Revision: 214718

URL: https://gcc.gnu.org/viewcvs?rev=214718&root=gcc&view=rev
Log:
2014-08-29  Paolo Carlini  <paolo.carlini@oracle.com>

	PR c++/61484
	* g++.dg/cpp0x/constexpr-61484.C: New.

Added:
    trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-61484.C
Modified:
    trunk/gcc/testsuite/ChangeLog
Comment 5 Paolo Carlini 2014-08-29 08:44:36 UTC
Done.