[cfe-commits] [PATCH] for bug 7970 and another member declaration bug found along the way
Faisal Vali
faisalv at gmail.com
Fri Aug 27 17:32:34 PDT 2010
This is an updated patch which spits out more consistent sounding
error messages.
In Sema::MergeVarDecl, instead of doing (pseudo code)
if (LR.isSingleResult())
PDecl = LR.getFoundDecl()
I used:
if (!LR.empty())
PDecl = LR.getRepresentativeDecl()
Thanks!
Faisal Vali
On Fri, Aug 27, 2010 at 6:47 PM, Faisal Vali <faisalv at yahoo.com> wrote:
> Hi,
>
> This patch fixes the following bugs:
> - redeclaration of in class static variables (http://llvm.org/PR7970)
> - redeclaration of an in class non-static variable was allowed if
> *two* or more overloaded functions with that same name had already
> been declared
> i.e. struct S { void f(); int f(int); char f; }; would compile
> because Sema::LookupSingleResult in Sema::HandleField would return
> null
> if LookupResult was an overloaded result.
>
> I have attached a bunch of tests in p1 (not sure if they are all
> necessary), and if you review the test file, you'll see that depending
> on the ordering of member declarations
> (i.e data before functions or static before non-static) different
> error messages are spit out. Something smells quite brittle about
> this. I wonder if it
> would be worthwhile to try and unify these member declaration checks
> in one place and then call them consistently from HandleField,
> HandleDeclarator and MergeVarDecl,
> or would this complicate more than simplify?
>
> I verified my changes against the tests in SemaCXX and CXX.
>
> I am quite new at this so would appreciate any constructive feedback :)
>
> thanks,
> Faisal Vali
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: prevent-static-var-in-class-redeclaration-3.patch
Type: application/octet-stream
Size: 5483 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20100827/6f23ab9c/attachment.obj>
More information about the cfe-commits
mailing list