Bernard
Bernard

Reputation: 5690

MSVC list initialization ICE when used with structs?

This piece of code compiles well on gcc 8.1 and clang 6.0, but gives ICE on MSVC (both 2017 and 2018 pre-release):

#include <vector>
#include <string>

struct Data {
    unsigned char data;
};

struct A {
    std::string x;
    Data y{255};
};

void f(std::vector<A> arg) {
}

int main() {
    f(std::vector<A>{{"Test"}});
}

Clearly, I've run into yet another MSVC compiler bug.

But to be really sure: Does the above code conform to standard C++, or have I made an error as well?

Upvotes: 0

Views: 73

Answers (0)

Related Questions