Index: llvm/include/llvm/Demangle/ItaniumDemangle.h =================================================================== --- llvm/include/llvm/Demangle/ItaniumDemangle.h +++ llvm/include/llvm/Demangle/ItaniumDemangle.h @@ -4354,6 +4354,10 @@ case 'D': if (consumeIf("DnE")) return make("nullptr"); + // A template argument which happens to be a null pointer is mangled as if + // it were a literal 0 of the appropriate pointer type. + if (consumeIf("Dn0E")) + return make(make("std::nullptr_t"), "0"); return nullptr; case 'T': // Invalid mangled name per Index: llvm/test/tools/llvm-cxxfilt/null-pointer-template-arg.test =================================================================== --- /dev/null +++ llvm/test/tools/llvm-cxxfilt/null-pointer-template-arg.test @@ -0,0 +1,12 @@ +# As stated in the Itanium C++ ABI mangling section:A template argument +# which happens to be a null pointer is mangled as if it were a literal +# 0 of the appropriate pointer type; for example, "LPi0E" or "LDn0E". + +# RUN: llvm-cxxfilt _Z1fIDnLDnEEvv | FileCheck %s --check-prefix=NULLPTR +# NULLPTR: void f() + +# RUN: llvm-cxxfilt _Z1fIDnLDn0EEvv | FileCheck %s --check-prefix=TEMPARG1 +# TEMPARG1: void f() + +# RUN: llvm-cxxfilt _Z1fIPiLPi0EEvv | FileCheck %s --check-prefix=TEMPARG2 +# TEMPARG2: void f()