[PATCH] Provide fixit if unscoped enumeration is used in nested name specifier. This fixes PR16951.

Richard Smith richard at metafoo.co.uk
Fri Jan 16 18:04:51 PST 2015

LGTM with a couple of tweaks. (We should also fix the "is not a class, namespace, or scoped enumeration" diagnostic to remove the word "scoped", feel free to go ahead and commit a patch for that.)

Comment at: include/clang/Basic/DiagnosticSemaKinds.td:1232
@@ +1231,3 @@
+def ext_nested_name_spec_is_enum : ExtWarn<
+  "use of unscoped enumeration in a nested name specifier is a C++11 extension">,
+  InGroup<CXX11>;
Remove the "unscoped" here. C++98 didn't have scoped enumerations, and in any case, this diagnostic is not specific to unscoped enumerations.

Comment at: lib/Sema/SemaCXXScopeSpec.cpp:286-287
@@ +285,4 @@
+/// \param SD Declaration checked for nested-name-specifier.
+/// \param IsExtension If not null and the declaration may be used in extended
+/// syntax, the pointed variable is assigned true.
+bool Sema::isAcceptableNestedNameSpecifier(const NamedDecl *SD,
s/may be used in extended syntax/is accepted as an extension/



More information about the cfe-commits mailing list