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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to