From 192f19fae6c3446a5eaf37eb8730867ec86475f4 Mon Sep 17 00:00:00 2001 From: faisal vali Date: Sat, 11 Jun 2016 10:24:48 -0500 Subject: [PATCH 1/2] [namespace.udecl]/17 Fix the note and comment to better reflect that while using declarations can aid in resolving certain member-lookup ambiguities, they are not always sufficient. --- source/declarations.tex | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index 97d69b9946..fc3dcb83d0 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -2921,7 +2921,7 @@ Because a \grammarterm{using-declaration} designates a base class member (and not a member subobject or a member function of a base class subobject), a \grammarterm{using-declaration} cannot be used to resolve -inherited member ambiguities. For example, +inherited member ambiguities by itself. For example, \begin{codeblock} struct A { int x(); }; @@ -2935,8 +2935,12 @@ using C::x; int x(double); }; -int f(D* d) { - return d->x(); // ambiguous: \tcode{B::x} or \tcode{C::x} + +void f(D* d) { + d->x(); // ambiguous: selected overload \tcode{x()} from the result of name lookup of \tcode{x} in implicit naming class \tcode{D} + // (i.e. \{A::x(), C::x(int), D::x(double)\}) is a direct member of class \tcode{A} which is an ambiguous base + // of the naming class \tcode{D} + d->C::x(); // OK } \end{codeblock} \exitnote From c145057dbe8c12e0a93487fe2372008f657d049b Mon Sep 17 00:00:00 2001 From: faisal vali Date: Sat, 11 Jun 2016 20:41:42 -0500 Subject: [PATCH 2/2] Don't use x() instead of x, and add a clarifying comment on why the OK example is OK. --- source/declarations.tex | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/declarations.tex b/source/declarations.tex index fc3dcb83d0..647e1c8f36 100644 --- a/source/declarations.tex +++ b/source/declarations.tex @@ -2937,10 +2937,10 @@ }; void f(D* d) { - d->x(); // ambiguous: selected overload \tcode{x()} from the result of name lookup of \tcode{x} in implicit naming class \tcode{D} - // (i.e. \{A::x(), C::x(int), D::x(double)\}) is a direct member of class \tcode{A} which is an ambiguous base - // of the naming class \tcode{D} - d->C::x(); // OK + d->x(); // ambiguous: while member lookup of \tcode{x} in implicit naming class \tcode{D} is unambiguous, the selected + // overload of \tcode{x} is a direct member of \tcode{A}, which is an ambiguous base of the naming class \tcode{D} + d->C::x(); // OK: the selected \tcode{x} is a direct member of \tcode{A} which is an unambiguous base of the naming class \tcode{C} + // which in turn is an unambiguous base of the object expression's type \tcode{D} } \end{codeblock} \exitnote