<?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[Type conversion operator and switch]]></title><description><![CDATA[<p>Folgendes: <a href="http://ideone.com/IHsBfD" rel="nofollow">http://ideone.com/IHsBfD</a><br />
Warum? Das Objekt ist non-const also auch die non-const Version, oder nicht?<br />
Compiler-Bug?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/327539/type-conversion-operator-and-switch</link><generator>RSS for Node</generator><lastBuildDate>Wed, 08 Jul 2026 23:55:23 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/327539.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 18 Aug 2014 14:11:21 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Type conversion operator and switch on Mon, 18 Aug 2014 14:11:21 GMT]]></title><description><![CDATA[<p>Folgendes: <a href="http://ideone.com/IHsBfD" rel="nofollow">http://ideone.com/IHsBfD</a><br />
Warum? Das Objekt ist non-const also auch die non-const Version, oder nicht?<br />
Compiler-Bug?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2413935</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2413935</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 18 Aug 2014 14:11:21 GMT</pubDate></item><item><title><![CDATA[Reply to Type conversion operator and switch on Mon, 18 Aug 2014 14:36:55 GMT]]></title><description><![CDATA[<blockquote>
<p>Compiler-Bug?</p>
</blockquote>
<p>Zumindest ist der Compiler inkonsequent. Folgende Definition kompiliert:</p>
<pre><code>int i = f;
</code></pre>
<p>Und genau diese Deklaration sollte auch stattfinden um die Konvertierungsfunktion zu bestimmen:</p>
<blockquote>
<p>An expression <code>e</code> can be implicitly converted to a type <code>T</code> if and only if the declaration <code>T t=e;</code> is well-formed, for some invented temporary variable `t</p>
<p><code>\[..\] An expression</code>e <code>of class type</code>E <code>appearing in such a context is said to be contextually implicitly converted to a specified type</code>T <code>and is well-formed if and only if</code>e <code>can be implicitly converted to a type</code>T<code>that is determined as follows:</code>E<code>is searched for conversion functions whose return type is *cv*</code>T<code>or reference to *cv*</code>T<code>such that</code>T<code>is allowed by the context. There shall be exactly one such</code>T` .</p>
</blockquote>
<p>Es gibt genau ein solches <code>T</code> , <code>int</code> .</p>
<p>Laut Overload-Resolution ist aber AFAICS die non-const Version besser, wegen dem Objekt-Argument.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2413937</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2413937</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Mon, 18 Aug 2014 14:36:55 GMT</pubDate></item><item><title><![CDATA[Reply to Type conversion operator and switch on Mon, 18 Aug 2014 14:48:05 GMT]]></title><description><![CDATA[<p>Arcoth schrieb:</p>
<blockquote>
<blockquote>
<p>Compiler-Bug?</p>
</blockquote>
<p>Zumindest ist der Compiler inkonsequent. Folgende Definition kompiliert:</p>
<pre><code>int i = f;
</code></pre>
</blockquote>
<p>Ja, das fiel mir auch auf.</p>
<blockquote>
<p>[...]</p>
</blockquote>
<p>Das denke ich auch. Es sollte gehen.<br />
Aber sowohl bei meinem TDM-GCC und dem GCC in ideone gehts nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2413942</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2413942</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 18 Aug 2014 14:48:05 GMT</pubDate></item><item><title><![CDATA[Reply to Type conversion operator and switch on Mon, 18 Aug 2014 19:44:59 GMT]]></title><description><![CDATA[<p>n3337 schrieb:</p>
<blockquote>
<p>6.4.2 The switch statement<br />
[...]<br />
The condition shall be of integral type, enumeration type, or of a class type for which a single non-explicit conversion function to integral or enumeration type exists (12.3).</p>
</blockquote>
<p>Im Gegensatz zu C ist switch typmäßig nicht auf int beschränkt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2414019</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414019</guid><dc:creator><![CDATA[camper]]></dc:creator><pubDate>Mon, 18 Aug 2014 19:44:59 GMT</pubDate></item><item><title><![CDATA[Reply to Type conversion operator and switch on Mon, 18 Aug 2014 20:00:45 GMT]]></title><description><![CDATA[<p>camper schrieb:</p>
<blockquote>
<p>n3337 schrieb:</p>
<blockquote>
<p>6.4.2 The switch statement<br />
[...]<br />
The condition shall be of integral type, enumeration type, or of a class type for which a single non-explicit conversion function to integral or enumeration type exists (12.3).</p>
</blockquote>
<p>Im Gegensatz zu C ist switch typmäßig nicht auf int beschränkt.</p>
</blockquote>
<p>Und das heißt jetzt genau was?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2414023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414023</guid><dc:creator><![CDATA[Nathan]]></dc:creator><pubDate>Mon, 18 Aug 2014 20:00:45 GMT</pubDate></item><item><title><![CDATA[Reply to Type conversion operator and switch on Tue, 19 Aug 2014 15:17:20 GMT]]></title><description><![CDATA[<p>camper zitiert glatt N3337, und ich habe in N3797 nachgeschaut - wo die zitierte Regel natürlich nicht so enthalten ist, da sie geändert wurde.</p>
<p>Läuft es wenn du -std=c++1y angibst? Denn in C++14 wird die condition contextually implicitly converted, und da ist die Regel anders formuliert.</p>
<p>Edit: Ja, läuft.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2414031</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414031</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 19 Aug 2014 15:17:20 GMT</pubDate></item><item><title><![CDATA[Reply to Type conversion operator and switch on Tue, 19 Aug 2014 20:31:41 GMT]]></title><description><![CDATA[<p>camper, bist du <a href="http://www.c-plusplus.net/forum/283163-full" rel="nofollow">headmyshoulder</a>? Die Altersangabe stimmt perfekt - seine Beschreibung passt auch. Sein Artikel passt ebenfalls. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
<p>Edit: Ich hab' ihn! camper ist <a href="http://www.karstenahnert.com/about/" rel="nofollow">Karsten Ahnert</a>!</p>
<p>Edit²: Nein, ist er nicht. <a href="http://www.c-plusplus.net/forum/p1334574#1334574" rel="nofollow">http://www.c-plusplus.net/forum/p1334574#1334574</a><br />
Oder hat er versucht seine Identität durch eine etwas uneloquentere und unbeholfene Ausdrucksweise und falsche Informationen zu verschleiern?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2414165</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2414165</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Tue, 19 Aug 2014 20:31:41 GMT</pubDate></item></channel></rss>