public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template
@ 2022-01-05 16:52 johelegp at gmail dot com
  2022-01-05 17:01 ` [Bug c++/103921] " johelegp at gmail dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: johelegp at gmail dot com @ 2022-01-05 16:52 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 103921
           Summary: [modules] ICE requires in explicit-specifier of
                    instantiation of imported template
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: ice-on-valid-code
          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/Tb1eMbE3W.
I think it's valid because Clang accepts it: https://godbolt.org/z/xcK7Kenb5.

mod.cpp:
```C++
export module mod;

export template<class N> struct quantity {
  template<class N2>
  explicit(requires { 0; }) operator quantity<N2>() const;
};

export template<class N1, class N2>
bool operator==(const quantity<N1>& l, const quantity<N2>& r);
```

test.cpp:
```C++
import mod;
int main() {
  return requires { quantity<int>{} == quantity<double>{}; };
}
```

Output:
```
In module mod, imported at /app/test.cpp:1:
mod.cpp: In instantiation of 'struct quantity@mod<int>':
test.cpp:3:35:   required from here
mod.cpp:5:29: internal compiler error: Segmentation fault
    5 |   explicit(requires { 0; }) operator quantity<N2>() const;
      |                             ^~~~~~~~
0x2139bd9 internal_error(char const*, ...)
        ???:0
0x9ada27 tsubst(tree_node*, tree_node*, int, tree_node*)
        ???:0
0x9f2c99 instantiate_class_template(tree_node*)
        ???:0
0xa184bc finish_compound_literal(tree_node*, tree_node*, int, fcl_t)
        ???:0
0x97a00d c_parse_file()
        ???:0
0xb08022 c_common_parse_file()
        ???:0
Please submit a full bug report,
with preprocessed source if appropriate.
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-02-09 16:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 16:52 [Bug c++/103921] New: [modules] ICE requires in explicit-specifier of instantiation of imported template johelegp at gmail dot com
2022-01-05 17:01 ` [Bug c++/103921] " johelegp at gmail dot com
2022-01-05 18:15 ` [Bug c++/103921] [modules] ICE dependent expression " johelegp at gmail dot com
2022-01-05 18:25 ` johelegp at gmail dot com
2022-01-05 18:27 ` johelegp at gmail dot com
2022-02-09 16:32 ` johelegp at gmail dot com

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).