This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/59550] New: compiler crash when forming a pointer to a reference would be needed in std::initalizer_list


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

            Bug ID: 59550
           Summary: compiler crash when forming a pointer to a reference
                    would be needed in std::initalizer_list
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ali.baharev at gmail dot com

Code:

#include <fstream>
#include <initializer_list>
using namespace std;

void writeSomething(initializer_list<ofstream&> args) {
    for (auto f : args )
        f << "hello" << endl;
}

int main() {
    ofstream outputFile("data_1.txt");
    writeSomething({outputFile});
}

Online demonstration:

http://ideone.com/vTHDFy

This code came up at 

http://stackoverflow.com/q/20665699/341970


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]