error: 'basic_string<_CharT, _Traits, _Allocator>' is missing exception specification

Bug #1610168 reported by Giuseppe D'Angelo on 2016-08-05
66
This bug affects 13 people
Affects Status Importance Assigned to Milestone
libc++ (Debian)
Fix Released
Unknown
libc++ (Ubuntu)
High
Unassigned
Xenial
High
Unassigned

Bug Description

This is mirroring Debian bug #808086 https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808086

Compiling any source file that includes <string> with clang 3.8 and -std=c++11 -stdlib=libc++ results in a compile error.

While this is a minor bug in Debian (as it doesn't ship 3.8 yet), xenial does, and that's a major problem as it makes libc++ useless.

clang: warning: argument unused during compilation: '-stdlib=libc++'
In file included from test.cpp:1:
In file included from /usr/include/c++/v1/iostream:38:
In file included from /usr/include/c++/v1/ios:216:
In file included from /usr/include/c++/v1/__locale:15:
/usr/include/c++/v1/string:1938:44: error: 'basic_string<_CharT, _Traits, _Allocator>' is missing exception specification 'noexcept(is_nothrow_copy_constructible<allocator_type>::value)'
basic_string<_CharT, _Traits, _Allocator>::basic_string(const allocator_type& __a)
                                           ^
/usr/include/c++/v1/string:1326:76: note: previous declaration is here
    __attribute__ ((__visibility__("hidden"), __always_inline__)) explicit basic_string(const allocator_type& __a)
                                                                           ^
1 error generated.

--

Update (30 Aug 2017): as per https://wiki.ubuntu.com/StableReleaseUpdates :

[Impact]

This bug makes it impossible to compile any C++11 source file that includes <string> with clang 3.8 using libc++. Any non-trivial C++11 codebase is affected, making the whole libc++ package useless.

[Test Case]

See above. Create a C++ file that simply contains #include <string> and compile it with clang++ -std=c++11 -stdlib=libc++ file.cpp.

[Regression Potential]

The current <string> header simply does not work with clang-3.8 under any condition, so there is no regression potential.

The regression potential for GCC is also extremely limited: no package whatsoever uses GCC in combination with libc++, and the fact that GCC 5.4 -- currently in Xenial -- does not detect the error that Clang detects is just showing that GCC is bugged in this regard.

[Other Info]

The patch/workaround fixes the problem. See also the discussion at the linked Debian bug report as well as https://stackoverflow.com/q/37096062

affects: libc++ (Ubuntu) → ubuntu
affects: ubuntu → libc++ (Ubuntu)
Launchpad Janitor (janitor) wrote :

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

Changed in libc++ (Ubuntu):
status: New → Confirmed
Tony Lewis (tonyelewis) wrote :

This problem's still active in 16.10 (Yakkety).

Discussion of this issue on Stack Overflow:

http://stackoverflow.com/q/37096062

One commenter ("peppe") argues this bug is worse on Ubuntu than on Debian because the broken version only ships as experimental in Debian.

Workaround:

http://stackoverflow.com/a/38385967

VestniK (vestnik) wrote :

I've added patch to solve this issue to the list of debian/patches rebuild the package and checked that this issue is fixed. Debdiff file is attached.

The attachment "proposed patch to the deb package in xenial" seems to be a debdiff. The ubuntu-sponsors team has been subscribed to the bug report so that they can review and hopefully sponsor the debdiff. If the attachment isn't a patch, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are member of the ~ubuntu-sponsors, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issue please contact him.]

tags: added: patch
Simon Quigley (tsimonq2) wrote :

Hello!

Could you please indicate which releases are still affected by this? Also, if you would like to get this in Xenial, which is a stable release, please follow the SRU policy: https://wiki.ubuntu.com/StableReleaseUpdates

For now, I'm unsubscribing ~ubuntu-sponsors because it's not clear what there is to sponsor. Please feel free to resubscribe ~ubuntu-sponsors once things are clarified.

Thanks!

Giuseppe D'Angelo (dangelo) wrote :

Hello,

Xenial is still affected by this AFAICS. And yes, I'd like it to be fixed there.

17.04/17.10 shouldn't be affected, as they're using libc++ 3.9.1 which has fixed the corresponding bug in Debian. (No idea about ~ubuntu-sponsors, to be honest...).

Giuseppe D'Angelo (dangelo) wrote :

Added the SRU info, added ~ubuntu-bug-control.

description: updated
Giuseppe D'Angelo (dangelo) wrote :

Could also someone set the severity to High? As per:

"Renders essential features or functionality of the application or dependencies broken or ineffective "

Changed in libc++ (Ubuntu):
importance: Undecided → High
Simon Quigley (tsimonq2) wrote :

Sponsored to Xenial.

Thank you for your contribution to Ubuntu! It's really appreciated. :)

Changed in libc++ (Debian):
status: Unknown → Fix Released
Changed in libc++ (Ubuntu Xenial):
importance: Undecided → High
Changed in libc++ (Ubuntu Xenial):
status: New → In Progress
Changed in libc++ (Ubuntu):
status: Confirmed → Fix Released

Hello Giuseppe, or anyone else affected,

Accepted libc++ into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/libc++/3.7.0-1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed.Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-xenial to verification-done-xenial. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-xenial. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in libc++ (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-xenial
Giuseppe D'Angelo (dangelo) wrote :

Seems to be working just fine here, thank you very much!

Verification steps:

1. Get a C++11 source file that #includes <string>:

#include <string>

int main() {
    std::string s{"foobar"};
}

2. compile it with clang++ -stdlib=libc++ -std=c++11

3. if it compiles (which now it does) the bug is fixed.

tags: added: verification-done-xenial
removed: verification-needed verification-needed-xenial
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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