r372624 - Fix __is_fundamental to accept nullptr_t

Zoe Carver via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 23 09:02:47 PDT 2019


Author: zoecarver
Date: Mon Sep 23 09:02:46 2019
New Revision: 372624

URL: http://llvm.org/viewvc/llvm-project?rev=372624&view=rev
Log:
    Fix __is_fundamental to accept nullptr_t

    Summary: This patch updates the __is_fundamental builtin type trait to return true for nullptr_t.

    Reviewers: rsmith, EricWF, efriedma, craig.topper, erichkeane

    Subscribers: cfe-commits

    Tags: #clang

    Differential Revision: https://reviews.llvm.org/D67899

Modified:
    cfe/trunk/include/clang/AST/Type.h
    cfe/trunk/test/SemaCXX/type-traits.cpp

Modified: cfe/trunk/include/clang/AST/Type.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Type.h?rev=372624&r1=372623&r2=372624&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Type.h (original)
+++ cfe/trunk/include/clang/AST/Type.h Mon Sep 23 09:02:46 2019
@@ -6353,6 +6353,7 @@ inline bool QualType::isCForbiddenLValue
 /// \returns True for types specified in C++0x [basic.fundamental].
 inline bool Type::isFundamentalType() const {
   return isVoidType() ||
+         isNullPtrType() ||
          // FIXME: It's really annoying that we don't have an
          // 'isArithmeticType()' which agrees with the standard definition.
          (isArithmeticType() && !isEnumeralType());

Modified: cfe/trunk/test/SemaCXX/type-traits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/type-traits.cpp?rev=372624&r1=372623&r2=372624&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/type-traits.cpp (original)
+++ cfe/trunk/test/SemaCXX/type-traits.cpp Mon Sep 23 09:02:46 2019
@@ -802,6 +802,7 @@ void is_fundamental()
   int t23[T(__is_fundamental(unsigned long))];
   int t24[T(__is_fundamental(void))];
   int t25[T(__is_fundamental(cvoid))];
+  int t26[T(__is_fundamental(decltype(nullptr)))];
 
   int t30[F(__is_fundamental(Union))];
   int t31[F(__is_fundamental(UnionAr))];




More information about the cfe-commits mailing list