https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114388

--- Comment #10 from Jiang An <de34 at live dot cn> ---
Broken down into two smaller examples:


https://godbolt.org/z/YhK7PqE6s
```
#include <cstdio>
#include <typeinfo>

int main() {
  struct B {
    B() {}
    virtual ~B() { std::puts("C++11"); }
  };

  struct C { B b; };
  typeid(C().b); // unevaluated in C++98, evaluated in C++11
}
```

https://godbolt.org/z/on76q4Mx5
```
#include <cstdio>

int main() {
  struct B {
    B() {}
    B(const B&) { std::puts("C++98"); }
  };
  struct D : B {};

  struct BB { B b; };
  struct DD { D d; };

  true ? BB().b : DD().d; // additional copy in C++98, no copy or move in C++11
}
```

CWG2887 (https://cplusplus.github.io/CWG/issues/2887.html) is related.

Reply via email to