mercredi 4 mai 2016

c++: use or not use namespace in function argument list

Consider such simple example:

namespace foo {
    struct Foo {};
    struct Boo {
        void f(Foo);
    };
}

using foo::Boo;

void Boo::f(Foo)
{

}

clang and gcc compile such code without errors (-pedantic -std=c++11), but VC++-2015 report error about Foo type in void Boo::f(Foo) - Foo underclared identifier. If rewrite code like this: void Boo::f(foo::Foo) it compiles just fine, but what interesting it also compiles after such rewrite:

namespace foo {
    struct Foo {};
    struct Boo {
        void f(Foo);
    };
}

void foo::Boo::f(Foo)
{

}

is it VC++2015 bug according to c++11 standard?

Aucun commentaire:

Enregistrer un commentaire