std::experimental::filesystem missing exception specification noexcept build error regression (libstdc++-11-dev 11.3.0-1ubuntu1~22.04 upgrade)

Bug #1995569 reported by Andreas Mohr
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
gcc-11 (Ubuntu)
Expired
Undecided
Unassigned

Bug Description

Summary:
On Ubuntu 22.04.1 LTS using clang 11, I'm newly (REGRESSION) getting build errors on std::experimental::filesystem consumption cases:

.
.
.
In file included from ............./../../Compiler/StdFileSystem.h:37:
In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/experimental/filesystem:38:
/usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/experimental/bits/fs_path.h:1209:9: error: 'begin' is missing exception specification 'noexcept'
  path::begin() const

This very likely has been introduced by (dpkg.log)
2022-10-27 13:18:37 upgrade libstdc++-11-dev:amd64 11.2.0-19ubuntu1 11.3.0-1ubuntu1~22.04

Details:
No issues seen (working build) until very recently.
Analysis:
extraction of
libstdc++-11-dev_11.2.0-19ubuntu1_amd64.deb
( http://security.ubuntu.com/ubuntu/pool/main/g/gcc-11/ ), where
usr/include/c++/11/experimental/bits/fs_path.h
has:
    // iterators
    class iterator;
    typedef iterator const_iterator;

    iterator begin() const;
.
.
.
  inline path::iterator
  path::begin() const
  {
    if (_M_type == _Type::_Multi)
      return iterator(this, _M_cmpts.begin());
    return iterator(this, false);
  }

, as opposed to 11.3.0-1ubuntu1~22.04:

    // iterators
    class iterator;
    typedef iterator const_iterator;

    iterator begin() const noexcept;
.
.
.
  inline path::iterator
  path::begin() const
  {
    if (_M_type == _Type::_Multi)
      return iterator(this, _M_cmpts.begin());
    return iterator(this, false);
  }

(witness "noexcept" specification newly added, but
INCONSISTENTLY:
at declaration location only, and missing at implementation site)

Apparently fixed by
git://gcc.gnu.org/git/gcc.git commit
42eff613d0c10f "libstdc++: Add 'noexcept' to path::iterator members"
(but currently published for gcc >= 12 release tags only!).

A workaround might be
applying
-Wno-missing-exception-spec
( https://clang.llvm.org/docs/DiagnosticsReference.html )
in all std::experimental::filesystem consumption cases (only!).
Or being forced to
instead actively (source / config modification) switch to
std::filesystem (which
does not seem to have this INCONSISTENCY bug, in
/usr/include/c++/11/bits/fs_path.h
).

$ lsb_release -rd
Description: Ubuntu 22.04.1 LTS
Release: 22.04

$ apt-cache policy libstdc++-11-dev
libstdc++-11-dev:
  Installed: 11.3.0-1ubuntu1~22.04
  Candidate: 11.3.0-1ubuntu1~22.04
  Version table:
 *** 11.3.0-1ubuntu1~22.04 500
        500 http://de.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages
        100 /var/lib/dpkg/status
     11.2.0-19ubuntu1 500
        500 http://de.archive.ubuntu.com/ubuntu jammy/main amd64 Packages

Thank you for all your awesome service efforts!

P.S.: I got
"In what package did you find this bug?"
"libstdc++-11-dev" does not exist in Ubuntu. Please choose a different package. If you're unsure, please select "I don't know"
( at https://launchpad.net/ubuntu/+source/gcc-11/+filebug )
Though libstdc++-11-dev clearly *is* a "package".
--> this process is overly confusing, thus
possibly should be corrected.

Revision history for this message
Adam (justproger) wrote :

Solve this problem, please!!!!!!!!

Revision history for this message
Andreas Mohr (andi) wrote :

Yeah indeed, that would be useful. Ahem.

Especially since this bug has severity REGRESSION (something that used to "work appreciably" now doesn't "work appreciably"), as opposed to severity normal (e.g. a feature that is not working yet since it simply is not implemented yet, etc.).
Plus this is - by its nature - base infrastructure stuff, thus rather important...

And the fix ought to be really, really simple (very limited scope: a couple one-liner hunks, to get this CONSISTENCY bug fixed - well, maybe other than potential testing effort).

(myself I cannot provide a patch currently since
I don't have these things running ATM - would need some larger updating effort)

Thank you!

Revision history for this message
Matthias Klose (doko) wrote :

please could you provide a test case?

Changed in gcc-11 (Ubuntu):
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for gcc-11 (Ubuntu) because there has been no activity for 60 days.]

Changed in gcc-11 (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.