patchGNU source-highlight - Patches: patch #10135, Fix build on gcc-12 and clang

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #10135: Fix build on gcc-12 and clang

Submitter:  Sergei Trofimovich <slyfox>
Submitted:  Mon 08 Nov 2021 11:31:58 PM UTC
 
Category:  None Priority:  5 - Normal
Status:  None Privacy:  Public
Assigned to:  None Open/Closed:  Open

Mon 08 Nov 2021 11:31:58 PM UTC, original submission:  

Both gcc-12 and clang can't find ostream<<(..., std::pair<...>)
overload when compile lib/tests/test_wordtokenizer_main.cpp and
fail as:

  ./../srchilite/tostringcollection.h:103:9:
    error no match for «operator<<» (operand types are «std::ostringstream»
      {aka «std::__cxx11::basic_ostringstream<char>»}
      and «const std::pair<std::__cxx11::basic_string<char>,
                           std::__cxx11::basic_string<char> >»)
      103 |     buf << (*it);
          |     ~~~~^~~~~~~~

We fix it by placing overload to std namespace where std::pair<...>
is defined to make ADL work predictably.

clang also has a trouble compiling lib/tests/stdboosterror.h as:

    ./stdboosterror.h:7:72: error: parameter declarator cannot be qualified
            std_boost_exception(boost::regex_error(boost::regex_constants::error_bad_pattern));
                                                   ~~~~~~~~~~~~~~~~~~~~~~~~^

gcc compiles it by accident: https://gcc.gnu.org/PR86564

Let's disambiguate syntax by making it an explicit constructor call.

Sergei Trofimovich <slyfox>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by slyfox (Submitted the item)
  • -email is unavailable- added by slyfox
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

     

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-11-08 slyfox Attached File- Added 0001-Fix-tests-build-failure-on-clang-and-gcc-12.patch, #52225
        Carbon-Copy- Added -email is unavailable-

    Back to the top


    Powered by Savane 3.9