[Lldb-commits] [lldb] [clang] [clang-tools-extra] [c++20] P1907R1: Support for generalized non-type template arguments of scalar type. (PR #78041)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Jan 24 06:29:29 PST 2024
bgra8 wrote:
@bolshakov-a this is causing a regression in the way partial template specializations work.
For the following reproducer the partial template specialization is not used by the compiler when it is expected it should be used:
```
const char kt[] = "dummy";
template <class T, const char id[]>
class SomeTempl {
public:
explicit SomeTempl(T t) {
}
// The generic impl always returns 66.
int exit_code() const { return 66; }
private:
};
template <const char id[]>
class SomeTempl<int, id> {
public:
explicit SomeTempl(int s) : exit_code_(s) {
}
int exit_code() const { return exit_code_; }
private:
int exit_code_;
};
int main() {
SomeTempl<int, kt> dummy(0);
// This should return 0.
return dummy.exit_code();
}
```
Compile with: `clang -o /tmp/repro -x c++ /tmp/repro.cc `
It will return 0 (expected value when the specialization is used) before this patch and 66 (the generic impl is used) at this patch.
Could you please look into it? Reverting would be nice if a fix is necessary.
https://github.com/llvm/llvm-project/pull/78041
More information about the lldb-commits
mailing list