https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80240
Volker Reichelt <reichelt at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED CC| |reichelt at gcc dot gnu.org Resolution|--- |INVALID --- Comment #1 from Volker Reichelt <reichelt at gcc dot gnu.org> --- The C++ standard says in [expr.dynamic.cast]: 1 The result of the expression dynamic_cast<T>(v) is the result of converting the expression v to type T. T shall be a pointer or reference to a complete class type, or "pointer to cv void." intmax_t is neither a pointer or reference and that's what the error message says. The compiler is correct, your code is broken.