public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr
@ 2011-07-31 15:57 faisalv at yahoo dot com
2011-08-01 18:38 ` [Bug c++/49924] " jason at gcc dot gnu.org
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: faisalv at yahoo dot com @ 2011-07-31 15:57 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
Summary: [C++0X] [constexpr] can't initialize a non-static
member array of a literal type as a constexpr
Product: gcc
Version: 4.6.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: faisalv@yahoo.com
I believe the following code should compile:
struct A { constexpr A() { } };
struct B {
A array[1]; //non-static member array of a literal type w constexpr ctor
constexpr B() : array{} { } // here is the problem
};
int main()
{
constexpr B b{}; // won't compile
}
But i get the following output with g++4.6.1:
<output>
In function 'int main()':
<file>.cpp:11:17: error: '{{{A()}}}' is not a constant expression
</output>
FYI, the following does compile:
int main() { constexpr A a[1]{}; }
Thanks!
p.s
My gcc -v output is:
Using built-in specs.
COLLECT_GCC=g++-4.6.1
COLLECT_LTO_WRAPPER=/usr/local/gcc4.6.1/libexec/gcc/i686-pc-linux-gnu/4.6.1/lto-wrapper
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.6.1/configure --prefix=/usr/local/gcc4.6.1
--enable-generated-files-in-srcdir --enable-threads=posix --with-system-zlib
--enable-__cxa_atexit --disable-checking --disable-nls --enable-bootstrap
--with-gcc --with-gnu-as --with-gnu-ld --disable-multilib
Thread model: posix
gcc version 4.6.1 (GCC)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/49924] [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr
2011-07-31 15:57 [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr faisalv at yahoo dot com
@ 2011-08-01 18:38 ` jason at gcc dot gnu.org
2011-08-01 21:02 ` jason at gcc dot gnu.org
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-01 18:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |ASSIGNED
Last reconfirmed| |2011.08.01 18:37:43
AssignedTo|unassigned at gcc dot |jason at gcc dot gnu.org
|gnu.org |
Ever Confirmed|0 |1
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/49924] [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr
2011-07-31 15:57 [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr faisalv at yahoo dot com
2011-08-01 18:38 ` [Bug c++/49924] " jason at gcc dot gnu.org
@ 2011-08-01 21:02 ` jason at gcc dot gnu.org
2011-08-02 15:37 ` jason at gcc dot gnu.org
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-01 21:02 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-01 21:02:02 UTC ---
Author: jason
Date: Mon Aug 1 21:01:59 2011
New Revision: 177073
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177073
Log:
PR c++/49924
* semantics.c (cxx_eval_vec_init_1): Fix logic.
Added:
trunk/gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C
Modified:
trunk/gcc/cp/ChangeLog
trunk/gcc/cp/semantics.c
trunk/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/49924] [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr
2011-07-31 15:57 [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr faisalv at yahoo dot com
2011-08-01 18:38 ` [Bug c++/49924] " jason at gcc dot gnu.org
2011-08-01 21:02 ` jason at gcc dot gnu.org
@ 2011-08-02 15:37 ` jason at gcc dot gnu.org
2011-08-02 15:38 ` jason at gcc dot gnu.org
2011-08-02 16:15 ` faisalv at yahoo dot com
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-02 15:37 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
Jason Merrill <jason at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|ASSIGNED |RESOLVED
Resolution| |FIXED
Target Milestone|--- |4.6.2
--- Comment #3 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-02 15:37:15 UTC ---
Fixed for 4.6.2.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/49924] [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr
2011-07-31 15:57 [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr faisalv at yahoo dot com
` (2 preceding siblings ...)
2011-08-02 15:37 ` jason at gcc dot gnu.org
@ 2011-08-02 15:38 ` jason at gcc dot gnu.org
2011-08-02 16:15 ` faisalv at yahoo dot com
4 siblings, 0 replies; 6+ messages in thread
From: jason at gcc dot gnu.org @ 2011-08-02 15:38 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
--- Comment #2 from Jason Merrill <jason at gcc dot gnu.org> 2011-08-02 15:35:38 UTC ---
Author: jason
Date: Tue Aug 2 15:35:34 2011
New Revision: 177188
URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=177188
Log:
PR c++/49924
* semantics.c (cxx_eval_vec_init_1): Fix logic.
Added:
branches/gcc-4_6-branch/gcc/testsuite/g++.dg/cpp0x/constexpr-array4.C
Modified:
branches/gcc-4_6-branch/gcc/cp/ChangeLog
branches/gcc-4_6-branch/gcc/cp/semantics.c
branches/gcc-4_6-branch/gcc/testsuite/ChangeLog
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Bug c++/49924] [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr
2011-07-31 15:57 [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr faisalv at yahoo dot com
` (3 preceding siblings ...)
2011-08-02 15:38 ` jason at gcc dot gnu.org
@ 2011-08-02 16:15 ` faisalv at yahoo dot com
4 siblings, 0 replies; 6+ messages in thread
From: faisalv at yahoo dot com @ 2011-08-02 16:15 UTC (permalink / raw)
To: gcc-bugs
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49924
--- Comment #4 from Faisal Vali <faisalv at yahoo dot com> 2011-08-02 16:15:18 UTC ---
wow - that was quick - thank you Jason!!
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2011-08-02 16:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-31 15:57 [Bug c++/49924] New: [C++0X] [constexpr] can't initialize a non-static member array of a literal type as a constexpr faisalv at yahoo dot com
2011-08-01 18:38 ` [Bug c++/49924] " jason at gcc dot gnu.org
2011-08-01 21:02 ` jason at gcc dot gnu.org
2011-08-02 15:37 ` jason at gcc dot gnu.org
2011-08-02 15:38 ` jason at gcc dot gnu.org
2011-08-02 16:15 ` faisalv at yahoo dot com
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).