public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40689]  New: [C++0x]: error with initializer list in N2672
@ 2009-07-08 20:29 bernhard dot merkle at googlemail dot com
  2009-07-08 20:30 ` [Bug c++/40689] " bernhard dot merkle at googlemail dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: bernhard dot merkle at googlemail dot com @ 2009-07-08 20:29 UTC (permalink / raw)
  To: gcc-bugs

Hi, 

I think there is a bug in g++ 4.4 concerning the implementation of initializer
list. N2672

The following program does not compiles, but it should be accepted by g++.

// /opt/gcc-4.4/bin/g++ --std=c++0x -Wall
int main() 
{

class X 
{
 public:
  X(): data {1,2,3,4,5} {}
 private:
  const short data[5];
};
const float * pData = new const float[4] { 1.5, 2.5, 3.5, 4.5 };

    return 0;
}

$ /opt/gcc-4.4/bin/g++ -v
Using built-in specs.
Target: i686-pc-cygwin
Configured with: ./configure --prefix=/opt/gcc-4.4
Thread model: single
gcc version 4.4.0 (GCC)

$ /opt/gcc-4.4/bin/g++ --std=c++0x -Wall g++4.4BugN2672.cpp
g++4.4BugN2672.cpp: In constructor 'main()::X::X()':
g++4.4BugN2672.cpp:8: error: conversion from '<brace-enclosed initializer
list>' to non-scalar type 'const short int [5]
' requested
g++4.4BugN2672.cpp: In function 'int main()':
g++4.4BugN2672.cpp:12: error: ISO C++ forbids initialization in array new
g++4.4BugN2672.cpp:12: warning: unused variable 'pData'


-- 
           Summary: [C++0x]: error with initializer list in N2672
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: bernhard dot merkle at googlemail dot com


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


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

end of thread, other threads:[~2009-07-14  5:18 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-08 20:29 [Bug c++/40689] New: [C++0x]: error with initializer list in N2672 bernhard dot merkle at googlemail dot com
2009-07-08 20:30 ` [Bug c++/40689] " bernhard dot merkle at googlemail dot com
2009-07-08 20:38 ` rguenth at gcc dot gnu dot org
2009-07-08 20:56 ` bernhard dot merkle at googlemail dot com
2009-07-08 21:05 ` rguenth at gcc dot gnu dot org
2009-07-09  0:36 ` paolo dot carlini at oracle dot com
2009-07-12 19:19 ` jason at gcc dot gnu dot org
2009-07-13  6:07 ` jason at gcc dot gnu dot org
2009-07-14  5:18 ` jason at gcc dot gnu dot org

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).