Public bug reported:

The following code fails to compile with g++-4.8:

  #include <array>
  const int i = 0;
  std::array<int, 1> bar = {
    [i] = 0
  };

I have since learned that designated initialization is not supported in
(GNU) C++.  In that case I would have expected a syntax error.

This is the compilation command and its output:

  $ g++-4.8 -Wall -std=gnu++11 main.cpp
  main.cpp:5:1: internal compiler error: in lookup_field_1, at cp/search.c:384  
               
   };                                                                           
                       
   ^
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See <file:///usr/share/doc/gcc-4.8/README.Bugs> for instructions.
  Preprocessed source stored into /tmp/ccUsV9BC.out file, please attach this to 
your bugreport.

The preprocessed source file is attached.  g++-4.8 --version reports
g++-4.8 (Ubuntu 4.8.1-2ubuntu1~12.04) 4.8.1.  I installed this package
using the instructions given in this answer:
http://askubuntu.com/a/271561.  Ubuntu release and package version are:

$ lsb_release -rd
Description:    Ubuntu 12.04.4 LTS
Release:        12.04
$ apt-cache policy g++-4.8
g++-4.8:
  Installed: 4.8.1-2ubuntu1~12.04
  Candidate: 4.8.1-2ubuntu1~12.04
  Version table:
 *** 4.8.1-2ubuntu1~12.04 0
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu/ 
precise/main i386 Packages
        100 /var/lib/dpkg/status

** Affects: gcc-4.8 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "Preprocessed source"
   
https://bugs.launchpad.net/bugs/1313102/+attachment/4097611/+files/ccUsV9BC.out

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1313102

Title:
  internal compiler error with std::array designated initialization

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1313102/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to