public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/106304] New: [modules] ICE compiling dynamic_cast in constexpr function (in tree_node, at cp/module.cc:9183)
@ 2022-07-14 17:15 johelegp at gmail dot com
  2022-07-26 10:03 ` [Bug c++/106304] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-07-14 17:15 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 106304
           Summary: [modules] ICE compiling dynamic_cast in constexpr
                    function (in tree_node, at cp/module.cc:9183)
           Product: gcc
           Version: 13.0
            Status: UNCONFIRMED
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: johelegp at gmail dot com
                CC: johelegp at gmail dot com
  Target Milestone: ---

See https://godbolt.org/z/xz4Mhd8Wc, which Clang accepts:
https://godbolt.org/z/saachff5d.

mod.cpp:
```C++
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);
}
```

test.cpp:
```C++
import mod;
static_assert(&x == y(x));
int main() { }
```

Output:
```
[ 50%] Building CXX object CMakeFiles/mod.dir/mod.cpp.o
mod.cpp:1:8: internal compiler error: in tree_node, at cp/module.cc:9183
    1 | export module mod;
      |        ^~~~~~
0x221f229 internal_error(char const*, ...)
        ???:0
0x74c10d fancy_abort(char const*, int, char const*)
        ???:0
0x8fd00f trees_out::tree_node(tree_node*)
        ???:0
0x8fde5f trees_out::core_vals(tree_node*)
        ???:0
0x902d6d trees_out::tree_value(tree_node*)
        ???:0
0x8fcf41 trees_out::tree_node(tree_node*)
        ???:0
0x8fde5f trees_out::core_vals(tree_node*)
        ???:0
0x902d6d trees_out::tree_value(tree_node*)
        ???:0
0x8fcf41 trees_out::tree_node(tree_node*)
        ???:0
0x8fde5f trees_out::core_vals(tree_node*)
        ???:0
0x902d6d trees_out::tree_value(tree_node*)
        ???:0
0x8fcf41 trees_out::tree_node(tree_node*)
        ???:0
0x8fde5f trees_out::core_vals(tree_node*)
        ???:0
0x902d6d trees_out::tree_value(tree_node*)
        ???:0
0x8fcf41 trees_out::tree_node(tree_node*)
        ???:0
0x8fde5f trees_out::core_vals(tree_node*)
        ???:0
0x902d6d trees_out::tree_value(tree_node*)
        ???:0
0x8fcf41 trees_out::tree_node(tree_node*)
        ???:0
0x8fde5f trees_out::core_vals(tree_node*)
        ???:0
0x902d6d trees_out::tree_value(tree_node*)
        ???:0
Please submit a full bug report, with preprocessed source (by using
-freport-bug).
Please include the complete backtrace with any bug report.
See <https://gcc.gnu.org/bugs/> for instructions.
```

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-14 13:23 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-14 17:15 [Bug c++/106304] New: [modules] ICE compiling dynamic_cast in constexpr function (in tree_node, at cp/module.cc:9183) johelegp at gmail dot com
2022-07-26 10:03 ` [Bug c++/106304] " redi at gcc dot gnu.org
2022-07-26 14:57 ` johelegp at gmail dot com
2022-10-14 13:07 ` cvs-commit at gcc dot gnu.org
2022-10-14 13:10 ` ppalka at gcc dot gnu.org
2022-10-14 13:22 ` ppalka at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).