[PATCH] MSVC compat: Allow lookup of friend types in enclosing namespaces

Reid Kleckner rnk at google.com
Thu Jul 10 17:25:21 PDT 2014

Comment at: lib/Sema/SemaDecl.cpp:10986
@@ +10985,3 @@
+        NamedDecl *ND = Previous.getFoundDecl();
+        Sema::SemaDiagnosticBuilder D =
+            Diag(NameLoc, diag::ext_friend_tag_redecl_outside_namespace);
Richard Smith wrote:
> Reid Kleckner wrote:
> > Richard Smith wrote:
> > > `auto`?
> > It used to be `auto`, but I had to feed it into addFriendTagNNSFixIt, so I made it explicit.  I guess I can flip it back.
> Maybe either make `addFriendTagNNSFixIt` take a `DiagnosticBuilder&` so it doesn't need to care about this, or make it return a `FixItHint`? (A default-constructed `FixItHint` will be ignored by the diagnostic renderer.)
I considered that, but FixItHint::CreateInsertion takes a StringRef, so I didn't think I could safely return one without UAF bugs.  Looks like it uses a std::string for storage, so it all works out.  Done in r212786.


More information about the cfe-commits mailing list