[Bug 2130718] Re: -Werror=template-id-cdtor error is emitted with C++ standard less than 20

Launchpad Bug Tracker 2130718 at bugs.launchpad.net
Mon Dec 29 12:33:47 UTC 2025


Status changed to 'Confirmed' because the bug affects multiple users.

** Changed in: gcc-defaults (Ubuntu)
       Status: New => Confirmed

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

Title:
  -Werror=template-id-cdtor error is emitted with C++ standard less than
  20

Status in gcc-defaults package in Ubuntu:
  Confirmed

Bug description:
  When compiling with C++11 standard I got an error `-Werror=template-id-cdtor` which is meant to be emitted with >= C++20 standard (https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wtemplate-id-cdtor):
  ```
  mav at mav:~# g++-14 --version
  g++-14 (Ubuntu 14.2.0-4ubuntu2~24.04) 14.2.0
  Copyright (C) 2024 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.

  mav at mav:~# g++-14 -Wall -Werror -std=gnu++11 main.cpp
  main.cpp:3:15: error: template-id not allowed for constructor in C++20 [-Werror=template-id-cdtor]
      3 |     Example<T>() {};
        |               ^
  main.cpp:3:15: note: remove the ‘< >’
  cc1plus: all warnings being treated as errors
  ```
  Bug is in gcc 15.2.1 too (checked on last Fedora).

  
  Ubuntu release:
  ```
  mav at mav:~# lsb_release -rd
  No LSB modules are available.
  Description:    Ubuntu 24.04.3 LTS
  Release:        24.04
  ```
  Packages versions:
  ```
  mav at mav:~# apt-cache policy gcc-14
  gcc-14:
    Installed: 14.2.0-4ubuntu2~24.04
    Candidate: 14.2.0-4ubuntu2~24.04
    Version table:
   *** 14.2.0-4ubuntu2~24.04 500
          500 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages
          500 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages
          100 /var/lib/dpkg/status
       14-20240412-0ubuntu1 500
          500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages
  mav at mav:~# apt-cache policy g++-14
  g++-14:
    Installed: 14.2.0-4ubuntu2~24.04
    Candidate: 14.2.0-4ubuntu2~24.04
    Version table:
   *** 14.2.0-4ubuntu2~24.04 500
          500 http://archive.ubuntu.com/ubuntu noble-updates/universe amd64 Packages
          500 http://security.ubuntu.com/ubuntu noble-security/universe amd64 Packages
          100 /var/lib/dpkg/status
       14-20240412-0ubuntu1 500
          500 http://archive.ubuntu.com/ubuntu noble/universe amd64 Packages
  ```

  
  Bug is reproducible.
  Minimum code example:
  ```
  template <typename T>
  class Example {
      Example<T>() {};
  };

  int main() {
      return 0;
  }
  ```
  Compile with -Wall -Werror. C++ standard can be either not selected or selected below than 20 (with >= C++20 error is legit).

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




More information about the foundations-bugs mailing list