public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/52315] New: [C++11] constexpr object of nested class
@ 2012-02-20 11:05 oleg.endo@t-online.de
  2012-02-20 13:43 ` [Bug c++/52315] " daniel.kruegler at googlemail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: oleg.endo@t-online.de @ 2012-02-20 11:05 UTC (permalink / raw)
  To: gcc-bugs

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52315

             Bug #: 52315
           Summary: [C++11] constexpr object of nested class
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: oleg.endo@t-online.de


I'm not sure whether this is valid/invalid C++11, but it seems a little weird. 
The following works as expected:

struct B
{
  constexpr B (unsigned v) noexcept : val (v) { }
  constexpr unsigned value (void) const noexcept { return val; }

  unsigned val;
};

struct A
{
  int stuff[B (16).value ()];
};


But moving struct B inside of struct A ...

struct A
{
  struct B
  {
    constexpr B (unsigned v) noexcept : val (v) { }
    constexpr unsigned value (void) const noexcept { return val; }

    unsigned val;
  };

  int stuff[ B (16).value () ];
};

... results in error: size of array 'stuff' is not an integral
constant-expression



Using built-in specs.
COLLECT_GCC=sh-elf-gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/sh-elf/4.7.0/lto-wrapper
Target: sh-elf
Configured with: ../gcc-trunk/configure --target=sh-elf --prefix=/usr/local
--enable-languages=c,c++ --enable-multilib --disable-libssp --disable-nls
--disable-werror --enable-lto --with-newlib --with-gnu-as --with-gnu-ld
--with-system-zlib
Thread model: single
gcc version 4.7.0 20120220 (experimental) (GCC)


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-03-13 11:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-20 11:05 [Bug c++/52315] New: [C++11] constexpr object of nested class oleg.endo@t-online.de
2012-02-20 13:43 ` [Bug c++/52315] " daniel.kruegler at googlemail dot com
2012-02-20 15:08 ` redi at gcc dot gnu.org
2012-02-20 23:00 ` jason at gcc dot gnu.org
2012-02-20 23:35 ` jakub at gcc dot gnu.org
2012-03-13 11:30 ` paolo.carlini at oracle 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).