[PATCH] D134928: [Sema] Don't treat a non-null template argument as if it were null.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 13 13:25:35 PDT 2022


efriedma added inline comments.


================
Comment at: clang/lib/Sema/SemaTemplate.cpp:6490-6491
 
   // C++11 [temp.arg.nontype]p1:
   //   - an address constant expression of type std::nullptr_t
   if (Arg->getType()->isNullPtrType())
----------------
aaron.ballman wrote:
> It's worth noting that the rules we follow changed slightly: http://eel.is/c++draft/temp.arg.nontype#2 so if we're making repairs in this area, are there broader changes we need to consider? (That's fine as a FIXME comment if the changes end up being unrelated to this specific fix.)
C++17 significantly revamped the rules for template arguments; we don't use this code at all for C++17 or later.  (It might be worth considering re-unifying the codepaths to some extent; first evaluate under the C++17 rules, then verify if the argument is valid under the earlier standard's rules.  But I really just wanted to write a quick bugfix for the obvious miscompile, not completely rewrite the code.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D134928



More information about the cfe-commits mailing list