On Jan 12, 2008, at 9:24 AM, Eli Friedman wrote: > On Jan 12, 2008 12:16 AM, Chris Lattner <[EMAIL PROTECTED]> wrote: >> Very nice, applied: >> http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080107/003745.html > > Cool. > > I have a minor correction to the patch: __func__ is a static const > char[], so the type in the array is actually > "Context.CharTy.getQualifiedType(QualType::Const)". Test: > void a() { > __func__[0] = 'a'; > } > should give an error with clang -fsyntax-only. > > Another small thing I didn't think of when I submitted the patch: > CurFunctionDecl needs to be null-checked. Testcase: > char* a = __func__; // File scope declaration
Both fixed, thanks! http://lists.cs.uiuc.edu/pipermail/cfe-commits/Week-of-Mon-20080107/003746.html Steve/Fariborz, is __func__ valid in an objc method? > gcc's exact behavior here is kind of weird, though... it considers > this mistake to be only a warning, and it lets through __FUNCTION__ > without even complaining; both __func__ and __FUNCTION__ end up > resolving to an empty string. I'm not sure if clang needs to copy gcc > here. I agree that that is pretty silly. >> Also note that your test above works better, but it is still not >> entirely happy: >> > I think that's dependent on my patch for compound literals... clang > doesn't currently deal with constant-testing of ImplicitCastExpr > correctly. Ok, thanks again Eli! -Chris _______________________________________________ cfe-dev mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
