Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CWG2887 [diff.cpp03.expr] Should we list the behavioral change of typeid in C++11 due to N3055? #6861

Open
frederick-vs-ja opened this issue Mar 19, 2024 · 2 comments

Comments

@frederick-vs-ja
Copy link
Contributor

In the following example, the operand of typeid (an xvalue of a polymorphic class type) wasn't evaluated in C++98, but was made to evaluated since C++11 due to N3055.

#include <typeinfo>
#include <cstdio>

struct B {
  virtual ~B() { std::puts("~B"); }
};

struct D : B {};

struct WrapB {
  B b;
};

struct WrapD {
  D d;
};

int main() {
  typeid(true ? WrapB().b : WrapD().d);
}
@t3nsor
Copy link
Contributor

t3nsor commented Mar 25, 2024

Issues like this need to be submitted to CWG so that we can review the example

@frederick-vs-ja
Copy link
Contributor Author

frederick-vs-ja commented Apr 18, 2024

@t3nsor Submitted an issue in the CWG repo. CWG2887

@frederick-vs-ja frederick-vs-ja changed the title [diff.cpp03.expr] Should we list the behavioral change of typeid in C++11 due to N3055? CWG2887 [diff.cpp03.expr] Should we list the behavioral change of typeid in C++11 due to N3055? Apr 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants