[Bug libstdc++/39880] New: Specialisation is_error_code_enum<errc> should not exist

chris_kohlhoff at internet-mail dot org gcc-bugzilla@gcc.gnu.org
Fri Apr 24 09:32:00 GMT 2009


The system_error header incorrectly provides the specialisation:

 template<>
   struct is_error_code_enum<errc>
   : public true_type { };

Only is_error_condition_enum<errc> should be specialised. The spurious
specialisation causes the following code to fail to compile:

  #include <system_error>

  int main()
  {
    std::error_code ec;
    if (ec == std::errc::not_supported)
      ;
  }

with error:

a.cpp: In function âint main()â:
a.cpp:6: error: ambiguous overload for âoperator==â in âec == (std::errc)95â
/usr/include/c++/4.4/system_error:279: note: candidates are: bool
std::operator==(const std::error_code&, const std::error_condition&)
/usr/include/c++/4.4/system_error:274: note:                 bool
std::operator==(const std::error_code&, const std::error_code&)

Expected result: code should compile without warning or error.


-- 
           Summary: Specialisation is_error_code_enum<errc> should not exist
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: chris_kohlhoff at internet-mail dot org


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



More information about the Gcc-bugs mailing list