[cfe-dev] Weird diagnostic about non-type template argument
Douglas Gregor
dgregor at apple.com
Mon Aug 16 07:32:53 PDT 2010
On Aug 16, 2010, at 3:33 AM, Chandler Carruth wrote:
> On Mon, Aug 16, 2010 at 3:21 AM, Abramo Bagnara <abramo.bagnara at gmail.com> wrote:
> Il 16/08/2010 11:48, Chandler Carruth ha scritto:
> > On Mon, Aug 16, 2010 at 2:24 AM, Enea Zaffanella <zaffanella at cs.unipr.it
> > <mailto:zaffanella at cs.unipr.it>> wrote:
> >
> > I think that, in point 3, Abramo was just referring to the wording
> > of the diagnostic, which maybe could be improved.
> >
> >
> > Sure. I've no problem improving the diagnostic, but I'm not sure what to
> > make it. Your first is close though, maybe: "a non-type template
> > argument which is the address of an object cannot be surrounded by
> > parentheses". I'm leery of using words like "type" because of the
> > "non-type" category of template arguments we're dealing with. I'm not
> > the best wordsmith though....
>
> Furtherly to exit with a fatal error is a bit overkill for things like
> that... do you agree?
>
> As I said in my original post, this being an ExtWarn seems plausible, but I don't personally find it compelling to support this syntax. I think it's actually worthwhile that the standard insists on a differentiated syntax in these two cases for the reason I originally pointed out -- this *isn't* an expression, and it shouldn't be thought of in that context.
>
> Perhaps others disagree, or have some large body of code that uses this extensively (seems rather unlikely to me though...), but either way, the code doesn't conform, and so it should at most be accepted as an extension with appropriate warnings.
This is core issue 773:
http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#773
And the committee is favoring allowing the parentheses. I suggest we make it an ExtWarn in C++98/03 mode, with clearer diagnostic text (if we can).
- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20100816/18c85da7/attachment.html>
More information about the cfe-dev
mailing list