[cfe-dev] DeclGroup Stuff

Douglas Gregor dgregor at apple.com
Tue May 12 14:37:38 PDT 2009


Hi Chris,

On Mar 29, 2009, at 9:59 AM, Chris Lattner wrote:
> I just landed a bunch of declgroup stuff (yay), but there are two
> outstanding issues:
> [snip]
> 2) Doug (and other C++ folks), I added a truly awful hack to
> SemaTemplate.cpp, which only works because of the current bit layout
> of DeclPtrTy and DeclGroupPtrTy.  The basic issue is that clang
> currently accepts malformed code like:
>
> template<typename X> int Y, Z;
>
> (and similar examples with one variable, for that matter).
>
> I am pretty sure that you can never have multiple declarators after a
> template specifier like this.

Right.

> However, the code in ParseTemplate.cpp
> that handles this just calls into
> ParseDeclarationOrFunctionDefinition, which can parse multiple
> declarators like the above.
>
> I think the best thing to do here is to change
> ParseTemplateDeclarationOrSpecialization to call something like
> ParseDeclarationOrFunctionDefinition that is known to never return
> multiple decls.  This could be typed as returning DeclPtrTy instead of
> DeclGroupPtrTy.

I like this option best, and have implemented it here:

   http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20090511/017158.html

	- Doug



More information about the cfe-dev mailing list