[cfe-dev] Preliminary reinterpret_cast Sema patch

Doug Gregor doug.gregor at gmail.com
Tue Oct 21 14:07:41 PDT 2008

On Tue, Oct 21, 2008 at 1:49 PM, Argiris Kirtzidis <akyrtzi at gmail.com> wrote:
> Doug Gregor wrote:
>> Sure, it's ambiguous, but we shouldn't warn about it because the code
>> isn't wrong (and isn't likely to be wrong).
> Ambiguous resolutions confuse people in general which was why I added the
> warning.
> But I don't have a strong opinion on how useful this warning is; e.g. it
> warns people over declarations that look like constructor calls but it's not
> likely for people to write stuff like
> T1(T2(x));
> since creating an object like that isn't very useful.
> If the consensus is that the warning doesn't add much value I'll remove it.

It seems to me that this kind of warning might be useful if something
does eventually go wrong. For example, if something that referenced
the name being declared was part of some semantic failure later on, it
might make sense to emit a note that said: "this was ambiguous but C++
says it should be a declaration; put parentheses around it to make it
an expression". However, as it is now I think it produces too many
false positives.

I'd like to hear others' opinions on the matter, though.

  - Doug

More information about the cfe-dev mailing list