kimgr added a comment. > only for the function templates that use Microsoft intrinsics (e.g. > _BitScanForward in TrailingZerosCounter<T>.) > So there's something in the parsing of builtins/intrinsics that requires > TUScope to be non-null.
For posterity, this was misdiagnosed on my part. It turns out the pp conditionals in MathExtras.h select the GCC-style intrinsics for Clang, even in MS compat mode (because `_MSC_VER` is consistently checked *after* `__has_builtin` and friends). So the problem is really with GCC builtins inside function templates. Here's a minimal repro: template <class T> int myctz(unsigned int value) { return __builtin_ctz(value); } https://reviews.llvm.org/D31697 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits