[Bug c++/106304] [modules] ICE compiling dynamic_cast in constexpr function (in tree_node, at cp/module.cc:9183)

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jul 26 10:03:45 GMT 2022


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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1
   Last reconfirmed|                            |2022-07-26
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=99769
           Keywords|rejects-valid               |ice-on-valid-code

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Please provide the compiler commands, not just a link to a cmake project on
godbolt, which is a pain to see what it's doing.

Only one file and one command is needed to reproduce this:

export module mod;

template<class T> struct A : T {
  constexpr A(T v) : T{v} { }
  ~A() = default; // Fixes GCC.
};

struct B {
  virtual ~B() = default;
};

export inline constexpr auto x = A{B{}};

export constexpr const A<B>* y(const B& b) {
  return dynamic_cast<const A<B>*>(&b);
}


$ g++ -std=c++20 mod.cpp -fmodules-ts -c
mod.cpp:1:8: internal compiler error: in tree_node, at cp/module.cc:9078
    1 | export module mod;
      |        ^~~~~~
Please submit a full bug report, with preprocessed source.
See <http://bugzilla.redhat.com/bugzilla> for instructions.
Preprocessed source stored into /tmp/ccYLb5i0.out file, please attach this to
your bugreport.


Maybe a dup of PR 99769 which fails at the same place in a typeid expression.


More information about the Gcc-bugs mailing list