[clang-tools-extra] [clang-tidy][NFC] Add test for redundant-parentheses on reference NTTPs (PR #233514)

Zeyi Xu via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 18 21:20:51 PST 2026


================
@@ -25,3 +25,18 @@ template <C N> decltype(auto) decltypeParameter() {
 static_assert(__is_same(decltype(returnParameter<C{1}>()), const C &));
 static_assert(__is_same(decltype(initParameter<C{1}>()), const C &));
 static_assert(__is_same(decltype(decltypeParameter<C{1}>()), const C &));
+
+// Substituting a reference template parameter into a template argument wraps
+// it in synthetic parentheses, e.g. 'Array<char, (PATTERN).size() * 10>'.
+struct StringView {
----------------
zeyi2 wrote:

Personally I'm fine with adding this test case. 

One small suggestion: could we move it to `redundant-parentheses-cxx14.cpp` and remove the comments? This uses a reference NTTP (not a C++20 class-type NTTP) and only needs C++14 for auto return type deduction.

https://github.com/llvm/llvm-project/pull/233514


More information about the cfe-commits mailing list