以下のコードが、どうも解せない。
namespace A { class class_in_A {} ; void f(class_in_A) { } } namespace B { void f(A::class_in_A) { } } int main() { A::class_in_A obj ; // lookup A::f via ADL. f(obj) ; { using B::f ; f(obj) ;// ambiguous. // B::F is using declaration. Y is not empty. } { using namespace B ; f(obj) ;// lookup B::f. // because it is not a using declaration, Y is empty. // GCC, MSVC, Comeau disagreed and make it ambiguous. } { using namespace B ; using B::f ; f(obj) ;// ambiguous? because it also contains using declaration? } }
規格を素直に解釈すると、こうなると思うのだが。
追記:ambiguousが正しかった。
No comments:
Post a Comment
You can use some HTML elements, such as <b>, <i>, <a>, also, some characters need to be entity referenced such as <, > and & Your comment may need to be confirmed by blog author. Your comment will be published under GFDL 1.3 or later license with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts.