[clang] [Clang] Fix handling of immediate escalation for inherited constructors (PR #112860)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 18 11:08:38 PDT 2024


efriedma-quic wrote:

Consider the following testcase:

```
struct ConstEval {
  consteval ConstEval(int) {}
};
struct SimpleCtor { constexpr SimpleCtor(int) {}};
struct TemplateCtor {
  template <class Anything = int> constexpr
  TemplateCtor (int arg) {}
};
struct ConstEvalMember1 : SimpleCtor {
    int y = 10;
    ConstEval x = y;
    using SimpleCtor::SimpleCtor;
};
struct ConstEvalMember2 : TemplateCtor {
    int y = 10;
    ConstEval x = y;
    using TemplateCtor::TemplateCtor;
};
void f() {
  ConstEvalMember1 i(0);
  ConstEvalMember2 i2(0);
}
```

With this patch, the first one produces an error, the second doesn't.  Which... seems dubious?  Not sure.  Inheriting the "immediate-escalating" property seems surprising to me.

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


More information about the cfe-commits mailing list