pranavk wrote:

This causes another mangling issue similar to 
[this](https://github.com/llvm/llvm-project/pull/133610#issuecomment-2787332042).

Here's the repro:

```
namespace {
template <int> struct enable_if {
  typedef int type;
};
template <bool _Bp, class> using enable_if_t = enable_if<_Bp>::type;
template <int __v> struct integral_constant {
  static const int value = __v;
};
template <bool _Val> using _BoolConstant = integral_constant<_Val>;
template <class _Tp, class _Up>
using _IsNotSame = _BoolConstant<__is_same(_Tp, _Up)>;
template <class...> using __expand_to_true = integral_constant<true>;
template <class...> __expand_to_true<> __and_helper(int);
template <class... _Pred> using _And = decltype(__and_helper<_Pred...>(0));
template <int> struct _OrImpl {
  template <class, class _First, class> using _Result = _OrImpl<_First::value>;
};
template <class... _Args>
using _Or =
    _OrImpl<sizeof...(_Args)>::template _Result<integral_constant<false>,
                                                _Args...>;
struct optional {
  template <class _Up, enable_if_t<_And<_IsNotSame<_Up, optional>,
                                        _Or<_IsNotSame<_Up, int>, int>>::value,
                                   int> = 0>
  void operator=(_Up);
};
} // namespace
optional f_opt;
void f() { f_opt = int{}; }
```

`clang -c -std=gnu++20 -x c++ /tmp/reduced.i`
`llvm-readelf -s -W reduced.o | grep -P 'optional.*aS.*srNS[0-9]_I'`

The subexpression srNS5_I...E violates the grammar at 
https://itanium-cxx-abi.github.io/cxx-abi/abi.html#expressions. The srN must be 
followed by an <unresolved-type>, which is allowed to be a <substitution> such 
as S5_, but not a substitution followed by I...E template arguments. LLVM, GNU, 
and Abseil demanglers correctly reject this name.



https://github.com/llvm/llvm-project/pull/132748
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to