c++ - Name lookup: downsides to using unqualified class name inside a class definition / omitting template parameters? -
in recent discussion, matter came whether or not should qualify current class' name in class definition, , use explicitly specialized templates when referring current template itself. sum up:
namespace foo { struct foo { dosomething(foo::foo& other); // arguably dosomething(foo& other); // arguably bad }; } template<typename t> struct bar { dosomething(bar<t>& other); // arguably dosomething(bar& other); // arguably bad }; problem is, no 1 claims hard facts, merely "the name lookup go wrong" versus "meh, never had problem".
in order settle this: are 2 conventions strictly equivalent or can "bad" 1 introduce ambiguities in name lookup? references current standard nice.
of course, argument of legibility should not taken account, i'm asking how standard-conforming compiler behave in corner cases. however, known implementation bugs welcome.
namespace foo { namespace foo { typedef int foo; } struct foo { int m_foo; foo( foo::foo const& o_foo ):m_foo(o_foo.m_foo) {} }; } int main() { ::foo::foo foo_(::foo::foo::foo{}); } in conclusion, foo.
Comments
Post a Comment