<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, May 16, 2014 at 10:31 AM, Uri Mann <span dir="ltr"><<a href="mailto:umann@symantec.com" target="_blank">umann@symantec.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div lang="EN-US" link="blue" vlink="purple"><div><p class="MsoNormal">I’m running into an error parsing the source:<u></u><u></u></p>
<p class="MsoNormal">// Enum.cpp<u></u><u></u></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">namespace</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> ns </span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">{</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">enum</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> _E E</span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">;</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">struct</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> _S S</span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">;</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">}</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">namespace</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> ns </span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">{</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">enum</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> _E E</span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">;</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">typedef</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> </span><span style="font-size:9.5pt;font-family:Consolas;color:blue;background:white">struct</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"> _S S</span><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">;</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;color:maroon;background:white">}</span><span style="font-size:9.5pt;font-family:Consolas;color:black;background:white"><u></u><u></u></span></p>
<p class="MsoNormal">// End Enum.cpp<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">CLang output:<u></u><u></u></p><p class="MsoNormal">enum.cpp(6,20) : error: typedef redefinition with different types ('enum _E' vs 'enum _E')<u></u><u></u></p>
<p class="MsoNormal"> typedef enum _E E;<u></u><u></u></p><p class="MsoNormal"> ^<u></u><u></u></p><p class="MsoNormal">enum.cpp(2,20) : note: previous definition is here<u></u><u></u></p><p class="MsoNormal">
typedef enum _E E;<u></u><u></u></p><p class="MsoNormal"> ^<u></u><u></u></p><p class="MsoNormal"><u></u> <u></u></p><p class="MsoNormal">I’m not a C++ “lawyer” so I’m not sure if this is a CLang issue, or a construct forbidden by the C++ standard? If this is in the standard, why does the same not apply to struct?</p>
</div></div></blockquote><div><br></div><div>This is ill-formed all by itself:</div><div><br></div><div> typedef enum _E E;</div><div><br></div><div>... because enums can't be forward-declared like that. But apparently we allow this in MS compatibility mode.</div>
<div><br></div><div>It seems that we only produce the error you reported if you run clang in MS compatibility mode but with C++11 disabled, which is not likely to be a well-tested setup.</div></div></div></div>