[PATCH] Do not add enums to prototype scope in C++ modes.

Richard Smith richard at metafoo.co.uk
Fri Feb 21 11:27:24 PST 2014

  Looks fine to me, thanks!

Comment at: lib/Sema/SemaDecl.cpp:12955-12956
@@ -12954,4 +12954,4 @@
   // it needs to go into the function scope.
-  if (InFunctionDeclarator)
+  if (!getLangOpts().CPlusPlus && InFunctionDeclarator)
In `ActOnTag` we have this condition:

  if (S->isFunctionPrototypeScope() && !getLangOpts().CPlusPlus &&
      InFunctionDeclarator && Name)

Is there a good reason for these to be different?

(I'm not particularly happy that `InFunctionDeclarator` is nonzero in the case where we've switched out of function declarator scope -- can you also update the comment in Sema.h to indicate that this value may be inaccurate in C++?)


More information about the cfe-commits mailing list