[PATCH] D110044: Print nullptr_t namespace qualified within std::

David Blaikie via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Sep 21 11:23:31 PDT 2021


dblaikie added inline comments.


================
Comment at: clang/lib/AST/Type.cpp:3045
   case NullPtr:
-    return "nullptr_t";
+    return "std::nullptr_t";
   case Overload:
----------------
aaron.ballman wrote:
> dblaikie wrote:
> > aaron.ballman wrote:
> > > Should this be `::std::nullptr_t` to differentiate it from odd things like:
> > > ```
> > > namespace my {
> > > namespace std {
> > > class nullptr_t {};
> > > }
> > > }
> > > ```
> > I was hoping not to get overly pedantic - I think clang omits the global namespace scope when naming other types in namespaces?
> > 
> > Yeah:
> > ```
> > scope.cpp:5:5: error: invalid operands to binary expression ('int' and 'ns::inner')
> >   1 + ns::inner();
> >   ~ ^ ~~~~~~~~~~~
> > ```
> > 
> > So this seems consistent with that, at least. That's true also when rendering template parameter type names, etc, so far as I know.
> Okay, I'm sold, thank you!
Thanks for the review!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D110044/new/

https://reviews.llvm.org/D110044



More information about the cfe-commits mailing list