Public bug reported:

Ubuntu release:
Description:    Ubuntu 20.04.6 LTS
Release:        20.04


Package version:
g++-16:
  Installed: 16-20260315-1ubuntu1~20~ppa1
  Candidate: 16-20260315-1ubuntu1~20~ppa1
  Version table:
 *** 16-20260315-1ubuntu1~20~ppa1 500
        500 http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu focal/main 
amd64 Packages
        100 /var/lib/dpkg/status

Trying to compile this program with '-g' options:

template<typename T>
auto bar(T&&) {
    return typename T::C();
}

auto foo() {
    return bar([](){
        struct A{
            struct C {};
        };
        return A();
    }());
}
using FailingAlias = decltype(foo());

int main() {}

Results in a segfault:
greyman@greyman: g++-16 -g main.cpp -o main
greyman@greyman: g++-16: internal compiler error: Segmentation fault signal 
terminated program cc1plus
Segmentation fault (core dumped)

But without '-g' everything works fine.

g++ version:
g++-16 (Ubuntu 16-20260315-1ubuntu1~20~ppa1) 16.0.1 20260315 (experimental) 
[trunk r16-8100-g3aca3bae8ee]
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.


Same result with:
g++-15 (Ubuntu 15.2.0-15ubuntu1~20~ppa2) 15.2.0
Copyright (C) 2025 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

And:
g++ (GCC) 17.0.0 20261129 (experimental)
Copyright (C) 2026 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

** Affects: gcc-16 (Ubuntu)
     Importance: Undecided
         Status: New

** Attachment added: "main.ii"
   https://bugs.launchpad.net/bugs/2180146/+attachment/6022871/+files/main.ii

** Summary changed:

- segfault when compiling programm with type-alias with -g option
+ segfault when compiling programm with specific type-alias with -g option

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2180146

Title:
  segfault when compiling programm with specific type-alias with -g
  option

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/gcc-16/+bug/2180146/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to