public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/112355] New: Internal compiler error when exporting using declaration of function template
@ 2023-11-02 19:01 davidfromonline at gmail dot com
  2023-11-02 19:03 ` [Bug c++/112355] " davidfromonline at gmail dot com
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: davidfromonline at gmail dot com @ 2023-11-02 19:01 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 112355
           Summary: Internal compiler error when exporting using
                    declaration of function template
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: davidfromonline at gmail dot com
  Target Milestone: ---

The following mostly valid code:

```cxx
module;

namespace n {

template<typename T>
void f() {
}

}

export module m;

export using n::f;
```

causes gcc to crash with

```console
<source>:3:1: error: global module fragment contents must be from preprocessor
inclusion
    3 | namespace n {
      | ^~~~~~~~~
<source>:13:17: internal compiler error: tree check: expected none of
template_decl, have template_decl in do_nonmember_using_decl, at
cp/name-lookup.cc:4853
   13 | export using n::f;
      |                 ^
0x8fbb6e tree_not_check_failed(tree_node const*, char const*, int, char const*,
...)
        gcc/source/gcc/tree.cc:8986
0x76f1d4 tree_not_check(tree_node*, char const*, int, char const*, tree_code)
        gcc/source/gcc/tree.h:3607
0x76f1d4 do_nonmember_using_decl
        gcc/source/gcc/cp/name-lookup.cc:4853
0xb63549 finish_nonmember_using_decl(tree_node*, tree_node*)
        gcc/source/gcc/cp/name-lookup.cc:6297
0xb6d974 finish_using_decl
        gcc/source/gcc/cp/parser.cc:21908
0xbb482f cp_parser_using_declaration
        gcc/source/gcc/cp/parser.cc:22072
0xbc8653 cp_parser_declaration
        gcc/source/gcc/cp/parser.cc:15335
0xbc85d4 cp_parser_module_export
        gcc/source/gcc/cp/parser.cc:15080
0xbc85d4 cp_parser_declaration
        gcc/source/gcc/cp/parser.cc:15276
0xbc908a cp_parser_toplevel_declaration
        gcc/source/gcc/cp/parser.cc:15356
0xbc908a cp_parser_translation_unit
        gcc/source/gcc/cp/parser.cc:5218
0xbc908a c_parse_file()
        gcc/source/gcc/cp/parser.cc:50627
0xd0f8e1 c_common_parse_file()
        gcc/source/gcc/c-family/c-opts.cc:1278
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.
Compiler returned: 1
```

See it live: http://desktop:10240/z/nj5q1b

(the crash still exists if the global module fragment comes from an #include, I
just made it this way to have a single-file reproduction)

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

* [Bug c++/112355] Internal compiler error when exporting using declaration of function template
  2023-11-02 19:01 [Bug c++/112355] New: Internal compiler error when exporting using declaration of function template davidfromonline at gmail dot com
@ 2023-11-02 19:03 ` davidfromonline at gmail dot com
  2023-11-02 19:03 ` pinskia at gcc dot gnu.org
  2023-11-02 19:04 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: davidfromonline at gmail dot com @ 2023-11-02 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

David Stone <davidfromonline at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |davidfromonline at gmail dot com

--- Comment #1 from David Stone <davidfromonline at gmail dot com> ---
Looks like this is a new bug in trunk. Works in 13.2

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

* [Bug c++/112355] Internal compiler error when exporting using declaration of function template
  2023-11-02 19:01 [Bug c++/112355] New: Internal compiler error when exporting using declaration of function template davidfromonline at gmail dot com
  2023-11-02 19:03 ` [Bug c++/112355] " davidfromonline at gmail dot com
@ 2023-11-02 19:03 ` pinskia at gcc dot gnu.org
  2023-11-02 19:04 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-02 19:03 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |DUPLICATE

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Almost an exact dup of bug 106849.

*** This bug has been marked as a duplicate of bug 106849 ***

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

* [Bug c++/112355] Internal compiler error when exporting using declaration of function template
  2023-11-02 19:01 [Bug c++/112355] New: Internal compiler error when exporting using declaration of function template davidfromonline at gmail dot com
  2023-11-02 19:03 ` [Bug c++/112355] " davidfromonline at gmail dot com
  2023-11-02 19:03 ` pinskia at gcc dot gnu.org
@ 2023-11-02 19:04 ` pinskia at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-11-02 19:04 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to David Stone from comment #1)
> Looks like this is a new bug in trunk. Works in 13.2

It is not, just extra checking is enabled by default when compiling the trunk
(unless you use the configure option --enable-checking=release).

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

end of thread, other threads:[~2023-11-02 19:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-02 19:01 [Bug c++/112355] New: Internal compiler error when exporting using declaration of function template davidfromonline at gmail dot com
2023-11-02 19:03 ` [Bug c++/112355] " davidfromonline at gmail dot com
2023-11-02 19:03 ` pinskia at gcc dot gnu.org
2023-11-02 19:04 ` pinskia 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).