The program below is expected to run successfully to completion since there
is no MyCtype facet installed in the classic locale (and, in fact, no facet
of that type can exist since it doesn't have an accessible ctor).

$ cat u.cpp && g++ -dumpversion && g++ u.cpp -static && ./a.out
#include <cassert>
#include <locale>

struct MyCtype: std::ctype<char> { private: MyCtype (); };

int main ()
{
    assert (std::has_facet<std::ctype<char> >(std::locale::classic ()));
    assert (!std::has_facet<MyCtype>(std::locale::classic ()));
}
4.1.0
Assertion failed: !std::has_facet<MyCtype>(std::locale::classic ()), file
u.cpp, line 9
Abort (core dumped)


-- 
           Summary: std::has_facet returns true for not installed derived
                    facets
           Product: gcc
           Version: 4.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sebor at roguewave dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30127

Reply via email to