Uploaded image for project: 'Core ReactOS'
  1. Core ReactOS
  2. CORE-20800

ATL collides with operator new from STL

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • None
    • None

    Description

      Introduced with 610b852, most code that uses stuff from C++ STL has to explicitly include <new> from STL if you compile an application or a library that uses anything with ATL. I discovered this in November 2024 when I just started developing wlanwiz.

      FAILED: dll/shellext/wlanwiz/CMakeFiles/wlanwiz.dir/scan.cpp.obj 
      ccache /home/runner/work/reactos/reactos/RosBE-CI/amd64/bin/x86_64-w64-mingw32-g++ -DD3D_UMD_INTERFACE_VERSION=0x000C -DDBG=1 -DDLL_EXPORT_VERSION=0x502 -DDXGKDDI_INTERFACE_VERSION=0x1052 -DMINGW_HAS_SECURE_API=1 -DNTDDI_VERSION=NTDDI_WIN10_FE -DPAL_STDCPP_COMPAT -DUNICODE -DUSE_COMPILER_EXCEPTIONS -DWINVER=0x502 -D_AMD64_ -D_CRT_DECLARE_NONSTDC_NAMES=1 -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_SUPPRESS_RESTRICT -D_DLL -D_GLIBCXX_HAVE_BROKEN_VSWPRINTF -D_M_AMD64 -D_M_X64 -D_NEW_DELETE_OPERATORS_ -D_SEH_ENABLE_TRACE -D_SETUPAPI_VER=0x502 -D_UNICODE -D_USE_PSEH3=1 -D_WIN32_IE=0x603 -D_WIN32_WINDOWS=0x502 -D_WIN32_WINNT=0xA00 -D_WIN64 -D__REACTOS__ -D__RELFILE__="&__FILE__[__FILE__[0] == '.' ? 6 : 38]" -D__USE_CRTIMP -D__x86_64__ -Idll/shellext/wlanwiz -I/home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz -I/home/runner/work/reactos/reactos/src/sdk/include -I/home/runner/work/reactos/reactos/src/sdk/include/crt -I/home/runner/work/reactos/reactos/src/sdk/include/ddk -I/home/runner/work/reactos/reactos/src/sdk/include/ndk -I/home/runner/work/reactos/reactos/src/sdk/include/psdk -I/home/runner/work/reactos/reactos/src/sdk/include/reactos -I/home/runner/work/reactos/reactos/src/sdk/include/reactos/libs -I/home/runner/work/reactos/reactos/src/sdk/include/vcruntime -I/home/runner/work/reactos/reactos/src/sdk/include/winrt -Isdk/include -Isdk/include/psdk -Isdk/include/ddk -Isdk/include/dxsdk -Isdk/include/reactos -Isdk/include/reactos/mc -I/home/runner/work/reactos/reactos/src/sdk/include/dxsdk -isystem /home/runner/work/reactos/reactos/src/sdk/lib/pseh/include -isystem /home/runner/work/reactos/reactos/src/sdk/lib/apisets -isystem /home/runner/work/reactos/reactos/src/sdk/lib/vcruntime/inc -isystem /home/runner/work/reactos/reactos/src/sdk/lib/cryptlib -isystem /home/runner/work/reactos/reactos/src/sdk/lib/tdilib -isystem /home/runner/work/reactos/reactos/src/sdk/include/reactos/libs/libjpeg -isystem /home/runner/work/reactos/reactos/src/sdk/include/reactos/libs/libpng -isystem /home/runner/work/reactos/reactos/src/sdk/include/reactos/libs/zlib -isystem /home/runner/work/reactos/reactos/src/sdk/include/reactos/libs/libtiff -isystem /home/runner/work/reactos/reactos/src/sdk/lib/atl -isystem /home/runner/work/reactos/reactos/src/sdk/lib/3rdparty/symcrypt/inc -isystem /home/runner/work/reactos/reactos/src/sdk/lib/3rdparty/symcrypt/lib -isystem /home/runner/work/reactos/reactos/src/sdk/include/reactos/libs/mbedtls -U_X86_ -UWIN32 -pipe -fms-extensions -fno-strict-aliasing -fno-common -mlong-double-64 -fno-aggressive-loop-optimizations -fno-builtin-acosf -fno-builtin-acosl -fno-builtin-asinf -fno-builtin-asinl -fno-builtin-atan2f -fno-builtin-atan2l -fno-builtin-atanf -fno-builtin-atanl -fno-builtin-ceilf -fno-builtin-ceill -fno-builtin-coshf -fno-builtin-coshl -fno-builtin-cosf -fno-builtin-cosl -fno-builtin-expf -fno-builtin-expl -fno-builtin-fabsf -fno-builtin-fabsl -fno-builtin-floorf -fno-builtin-floorl -fno-builtin-fmodf -fno-builtin-fmodl -fno-builtin-frexpf -fno-builtin-frexpl -fno-builtin-hypotf -fno-builtin-hypotl -fno-builtin-ldexpf -fno-builtin-ldexpl -fno-builtin-logf -fno-builtin-logl -fno-builtin-log10f -fno-builtin-log10l -fno-builtin-modff -fno-builtin-modfl -fno-builtin-powf -fno-builtin-powl -fno-builtin-sinhf -fno-builtin-sinhl -fno-builtin-sinf -fno-builtin-sinl -fno-builtin-sqrtf -fno-builtin-sqrtl -fno-builtin-tanhf -fno-builtin-tanhl -fno-builtin-tanf -fno-builtin-tanl -fno-builtin-feraiseexcept -fno-builtin-feupdateenv -gdwarf-2 -gstrict-dwarf -femit-struct-debug-detailed=none -feliminate-unused-debug-symbols -march=athlon64 -mtune=generic -Wall -Wpointer-arith -Wno-char-subscripts -Wno-multichar -Wno-unused-value -Wno-unused-const-variable -Wno-unused-local-typedefs -Wno-deprecated -Wno-unused-result -Wno-format -Wno-maybe-uninitialized -Wno-nonnull-compare -Wno-unknown-pragmas -O1 -mpreferred-stack-boundary=4 -mcx16 -fno-rtti -fexceptions -fplugin=/home/runner/work/reactos/reactos/build/host-tools/bin/gcc_plugin_seh.so -std=gnu++2a -MD -MT dll/shellext/wlanwiz/CMakeFiles/wlanwiz.dir/scan.cpp.obj -MF dll/shellext/wlanwiz/CMakeFiles/wlanwiz.dir/scan.cpp.obj.d -o dll/shellext/wlanwiz/CMakeFiles/wlanwiz.dir/scan.cpp.obj -c /home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz/scan.cpp
      Error: /home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz/scan.cpp:217:1: error: expected '}' at end of input
       }
       ^
      In file included from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_algo.h:62,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/algorithm:62,
                       from ../src/dll/shellext/wlanwiz/scan.cpp:9:
      /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h:182:5: note: to match this '{'
           {
           ^
      In file included from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/functexcept.h:40,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_algobase.h:60,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tree.h:63,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/set:60,
                       from ../src/dll/shellext/wlanwiz/main.h:8,
                       from ../src/dll/shellext/wlanwiz/scan.cpp:7:
      /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h: In static member function 'static void std::__uninitialized_construct_buf_dispatch<<anonymous> >::__ucr(_Pointer, _Pointer, _ForwardIterator)':
      Error: /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h:203:4: error: expected primary-expression before 'catch'
          __catch(...)
          ^~~~~~~
      In file included from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_algo.h:62,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/algorithm:62,
                       from ../src/dll/shellext/wlanwiz/scan.cpp:9:
      Error: /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h:211:3: error: a template declaration cannot appear at block scope
         template<>
         ^~~~~~~~
      Error: /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h:229:3: error: a template declaration cannot appear at block scope
         template<typename _Pointer, typename _ForwardIterator>
         ^~~~~~~~
      Error: /home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz/scan.cpp:217:1: error: expected '}' at end of input
       }
       ^
      In file included from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_algo.h:62,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/algorithm:62,
                       from ../src/dll/shellext/wlanwiz/scan.cpp:9:
      /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h:187:9: note: to match this '{'
               {
               ^
      /home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz/scan.cpp: At global scope:
      Error: /home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz/scan.cpp:217:2: error: expected ';' at end of input
       }
       ~^
        ;
      Error: /home/runner/work/reactos/reactos/src/dll/shellext/wlanwiz/scan.cpp:217:1: error: expected '}' at end of input
       }
       ^
      In file included from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_algo.h:62,
                       from /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/algorithm:62,
                       from ../src/dll/shellext/wlanwiz/scan.cpp:9:
      /home/runner/work/reactos/reactos/RosBE-CI/amd64/lib/gcc/x86_64-w64-mingw32/8.4.0/include/c++/bits/stl_tempbuf.h:63:1: note: to match this '{'
       {
       ^ 

      Two years forward, I had rediscovered this bug with inclusion of <algorithm> and <numeric> headers, and including <new> upfront fixes the compilation error.

      #pragma once
      #include <new> // put this one line down an it will break
      #include <algorithm>
      #include <numeric>
      #include <vector>
      #include <set> 

      Attachments

        Activity

          People

            Unassigned Unassigned
            SigmaTel71 SigmaTel71
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: