From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 621013858CDA; Sun, 9 Apr 2023 14:42:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 621013858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681051378; bh=0Vww0HPgHU20modBBEIJ7TX62A2MzxUQryOiNmZFLvU=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bujsFxy8yYYO9nrNKOBV40sEBMYXCVbjSJIHJyMFme1KTsz9YkM7pXDcuk/oa3Ntr 8Xut/f/MvrSyuFFnNFl2GDikJjGnqd21v1EkIJUsFo2A5ISUv+6F3LsbJzeh80/pD/ y/Q/m471Nz3+wghf6SV0ETmBSwyfU2dS4tyQ1oVQ= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/88508] std::bad_cast in std::basic_ostringstream.oss.fill() Date: Sun, 09 Apr 2023 14:42:57 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 8.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: DUPLICATE X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D88508 --- Comment #5 from Jonathan Wakely --- No, you can't disable it with SFINAE, because it's a runtime property. If y= ou define ctype yourself and add it to a locale at runtime, and use t= hat locale with the stream, then it works. We can't disable things at compile t= ime if the program can make them work at runtime. You get the same behaviour trying to use a stream of char16_t or unsigned c= har or std::byte or myprog::char_type. Like I said, it's not actually a problem with UTF-8. Streams just don't support any of those types out of the box, irrespective of the encoding they happen to use.=