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
prevent-static-var-in-class-redeclaration-2.patch
Description: Binary data
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
