Skip to content

Commit 469e9f0

Browse files
jensmaurerzygoloid
authored andcommitted
[namespace.udecl] Clarify error in example. (#1254)
1 parent 9725a4b commit 469e9f0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

source/declarations.tex

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,12 +3055,15 @@
30553055
member function, then all functions named shall be accessible. The base
30563056
class members mentioned by a \grammarterm{using-declarator} shall be
30573057
visible in the scope of at least one of the direct base classes of the
3058-
class where the \grammarterm{using-declarator} is specified. \begin{note}
3058+
class where the \grammarterm{using-declarator} is specified.
3059+
3060+
\pnum
3061+
\begin{note}
30593062
Because a \grammarterm{using-declarator} designates a base class member
30603063
(and not a member subobject or a member function of a base class
30613064
subobject), a \grammarterm{using-declarator} cannot be used to resolve
3062-
inherited member ambiguities. For example,
3063-
3065+
inherited member ambiguities.
3066+
\begin{example}
30643067
\begin{codeblock}
30653068
struct A { int x(); };
30663069
struct B : A { };
@@ -3074,9 +3077,10 @@
30743077
int x(double);
30753078
};
30763079
int f(D* d) {
3077-
return d->x(); // ambiguous: \tcode{B::x} or \tcode{C::x}
3080+
return d->x(); // error: overload resolution selects \tcode{A::x}, but \tcode{A} is an ambiguous base class
30783081
}
30793082
\end{codeblock}
3083+
\end{example}
30803084
\end{note}
30813085

30823086
\pnum

0 commit comments

Comments
 (0)