<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[ADL beachtet Namespace von template Argument eines übergebenen Klassenobjetes?]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">namespace A
{
	class Bar
	{
	};

	template&lt;class Arg&gt; void test(Arg){}
}

namespace B
{
	template&lt;class Dub&gt;
	class Foo
	{
		typedef Dub d;
	};

	class Foo2
	{
		typedef A::Bar d;
	};

	template&lt;class Arg&gt; void test(Arg){}
}

int main()
{
	B::Foo&lt;A::Bar&gt; f;
	test(f);/*
gcc 4.4:
main.cpp: In function 'int main()':
main.cpp:29: error: call of overloaded 'test(B::Foo&lt;A::Bar&gt;&amp;)' is ambiguous
main.cpp:23: note: candidates are: void B::test(Arg) [with Arg = B::Foo&lt;A::Bar&gt;]
main.cpp:7: note:                 void A::test(Arg) [with Arg = B::Foo&lt;A::Bar&gt;]
*/

	B::Foo2 f2;
	test(f2);//OK
}
</code></pre>
<p>Wieso beachtet der Compiler hier den A-Namespace? Ist dies Standardkonform? Falls ja, wo ist dies definiert? Ich konnte im aktuellen working draft leider nichts finden <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/247425/adl-beachtet-namespace-von-template-argument-eines-übergebenen-klassenobjetes</link><generator>RSS for Node</generator><lastBuildDate>Thu, 17 Sep 2026 13:52:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/247425.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 10 Aug 2009 21:18:36 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to ADL beachtet Namespace von template Argument eines übergebenen Klassenobjetes? on Mon, 10 Aug 2009 21:18:36 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">namespace A
{
	class Bar
	{
	};

	template&lt;class Arg&gt; void test(Arg){}
}

namespace B
{
	template&lt;class Dub&gt;
	class Foo
	{
		typedef Dub d;
	};

	class Foo2
	{
		typedef A::Bar d;
	};

	template&lt;class Arg&gt; void test(Arg){}
}

int main()
{
	B::Foo&lt;A::Bar&gt; f;
	test(f);/*
gcc 4.4:
main.cpp: In function 'int main()':
main.cpp:29: error: call of overloaded 'test(B::Foo&lt;A::Bar&gt;&amp;)' is ambiguous
main.cpp:23: note: candidates are: void B::test(Arg) [with Arg = B::Foo&lt;A::Bar&gt;]
main.cpp:7: note:                 void A::test(Arg) [with Arg = B::Foo&lt;A::Bar&gt;]
*/

	B::Foo2 f2;
	test(f2);//OK
}
</code></pre>
<p>Wieso beachtet der Compiler hier den A-Namespace? Ist dies Standardkonform? Falls ja, wo ist dies definiert? Ich konnte im aktuellen working draft leider nichts finden <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f61e.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--disappointed_face"
      title=":("
      alt="😞"
    /></p>
<p>Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1758534</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758534</guid><dc:creator><![CDATA[DubberDub]]></dc:creator><pubDate>Mon, 10 Aug 2009 21:18:36 GMT</pubDate></item><item><title><![CDATA[Reply to ADL beachtet Namespace von template Argument eines übergebenen Klassenobjetes? on Mon, 10 Aug 2009 21:29:45 GMT]]></title><description><![CDATA[<p>Ja, es steht so im Standard:</p>
<p>ISO-C++ §3.4.2/2 schrieb:</p>
<blockquote>
<p>For each argument type T in the function call, there is a set of zero or more associated namespaces and a set of zero or more associated classes to be considered.<br />
[...]<br />
If T is a non-archetype class type (including unions), its associated classes are: the class itself; the class<br />
of which it is a member, if any; and its direct and indirect base classes. Its associated namespaces are the namespaces of which its associated classes are members. <strong>Furthermore, if T is a class template specialization, its associated namespaces and classes also include: the namespaces and classes associated with the types of the template arguments provided for template type parameters (excluding template template parameters)</strong>; the namespaces of which any template template arguments are members; and the classes of which any member templates used as template template arguments are members. [ Note: non-type template arguments do not contribute to the set of associated namespaces.—end note ]</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1758536</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758536</guid><dc:creator><![CDATA[Old McDonald]]></dc:creator><pubDate>Mon, 10 Aug 2009 21:29:45 GMT</pubDate></item><item><title><![CDATA[Reply to ADL beachtet Namespace von template Argument eines übergebenen Klassenobjetes? on Mon, 10 Aug 2009 21:34:39 GMT]]></title><description><![CDATA[<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1758538</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1758538</guid><dc:creator><![CDATA[DubberDub]]></dc:creator><pubDate>Mon, 10 Aug 2009 21:34:39 GMT</pubDate></item></channel></rss>