Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

msvs12 treats braces as operator()

#include <iostream>

struct A
{
    void operator()(const char *)
    {
        std::cout << "void operator()(const char *)" << std::endl;
    }
};

int main(int argc, char* argv[])
{
    A a;

    a{"hi"};

    return 0;
}

msvs12 is happy with this code and I can't understand why. Is it bug or something else?

Update: I tried with msvs 2013 (v12.0.31101.0 Update 4)

like image 882
sliser Avatar asked Jul 01 '15 06:07

sliser


1 Answers

Yes it is a bug. Here is the ticket for it still opened.

like image 183
Paulo Alves Avatar answered Oct 21 '22 21:10

Paulo Alves