Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

self test fails (with newer compilers?) under redhat (RHEL7) #749

Closed
tortoise74 opened this issue Nov 21, 2016 · 4 comments
Closed

self test fails (with newer compilers?) under redhat (RHEL7) #749

tortoise74 opened this issue Nov 21, 2016 · 4 comments

Comments

@tortoise74
Copy link

I tried to run the self tests under RHEL7 as part of evaluating this library and I got the following error:

>mkdir build
>cd build
>cmake ../Projects/CMake
>make 
[  2%] Building CXX object CMakeFiles/SelfTest.dir/home/brucea/Downloads/Catch/projects/SelfTest/SurrogateCpps/catch_stream.cpp.o
In file included from /home/brucea/Downloads/Catch/include/internal/catch_stream.h:12:0,
                 from /home/brucea/Downloads/Catch/projects/SelfTest/SurrogateCpps/catch_stream.cpp:3:
/home/brucea/Downloads/Catch/include/internal/catch_compiler_capabilities.h:250:32: error: ‘auto_ptr’ in namespace ‘std’ does not name a type
 #   define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
                                ^
/home/brucea/Downloads/Catch/include/internal/catch_stream.h:52:9: note: in expansion of macro ‘CATCH_AUTO_PTR’
         CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
         ^
make[2]: *** [CMakeFiles/SelfTest.dir/home/brucea/Downloads/Catch/projects/SelfTest/SurrogateCpps/catch_stream.cpp.o] Error 1
make[1]: *** [CMakeFiles/SelfTest.dir/all] Error 2
make: *** [all] Error 2
>gcc --version
gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-4)

Also fails if I use gcc 4.9.3 (installed to /opt)

>gcc --version
gcc (GCC) 4.9.3
>CC=`which gcc` CXX=`which g++` cmake ../Projects/CMake
>make

Seems to work just fine on RHEL5 using an older compiler however.

rhel5>gcc --version
gcc (GCC) 4.1.2 20080704 (Red Hat 4.1.2-55)
@ghost
Copy link

ghost commented Nov 22, 2016

Also failed under gcc

gcc --version
gcc (GCC) 6.2.1 20160830

here the detailed error:

In file included from /home/kai/apps/Catch-master/include/internal/catch_stream.h:12:0,
                 from /home/kai/apps/Catch-master/projects/SelfTest/SurrogateCpps/catch_stream.cpp:3:
/home/kai/apps/Catch-master/include/internal/catch_compiler_capabilities.h:248:37: Fehler: »unique_ptr« in namespace »std« does not name a template type
 #   define CATCH_AUTO_PTR( T ) std::unique_ptr<T>
                                     ^
/home/kai/apps/Catch-master/include/internal/catch_stream.h:52:9: Anmerkung: bei Substitution des Makros »CATCH_AUTO_PTR«
         CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
         ^~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/SelfTest.dir/build.make:855: CMakeFiles/SelfTest.dir/home/kai/apps/Catch-master/projects/SelfTest/SurrogateCpps/catch_stream.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SelfTest.dir/all] Fehler 2
make: *** [Makefile:95: all] Fehler 2

and with clang

clang++ -v
clang version 3.9.0 (tags/RELEASE_390/final)

I get also an error (but a different one more like yours):

[ 89%] Building CXX object CMakeFiles/SelfTest.dir/home/kai/apps/Catch-master/projects/SelfTest/SurrogateCpps/catch_stream.cpp.o
In file included from /home/kai/apps/Catch-master/projects/SelfTest/SurrogateCpps/catch_stream.cpp:3:
/home/kai/apps/Catch-master/include/internal/catch_stream.h:52:9: error: no type named 'auto_ptr' in namespace 'std'
        CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kai/apps/Catch-master/include/internal/catch_compiler_capabilities.h:250:37: note: expanded from macro 'CATCH_AUTO_PTR'
#   define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
                               ~~~~~^
In file included from /home/kai/apps/Catch-master/projects/SelfTest/SurrogateCpps/catch_stream.cpp:3:
/home/kai/apps/Catch-master/include/internal/catch_stream.h:52:9: error: expected member name or ';' after declaration specifiers
        CATCH_AUTO_PTR( StreamBufBase ) m_streamBuf;
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/home/kai/apps/Catch-master/include/internal/catch_compiler_capabilities.h:250:45: note: expanded from macro 'CATCH_AUTO_PTR'
#   define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
                               ~~~~~~~~~~~~~^
2 errors generated.
make[2]: *** [CMakeFiles/SelfTest.dir/build.make:855: CMakeFiles/SelfTest.dir/home/kai/apps/Catch-master/projects/SelfTest/SurrogateCpps/catch_stream.cpp.o] Fehler 1
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/SelfTest.dir/all] Fehler 2
make: *** [Makefile:95: all] Fehler 2

But if I go to SelfTest and just use make (so no CMake) it works with gcc and with clang...

@Bu11etmagnet
Copy link

catch_stream.h (which uses CATCH_AUTO_PTR) forgot to #include <memory>

@horenmar
Copy link
Member

Is there a reason not to have single point #include <memory> when deciding whether to use unique_ptr or auto_ptr? Then it would be impossible to forget including <memory> when using CATCH_AUTO_PTR macro.

#include <memory>
#ifdef CATCH_CONFIG_CPP11_UNIQUE_PTR
#   define CATCH_AUTO_PTR( T ) std::unique_ptr<T>
#else
#   define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
#endif

@horenmar
Copy link
Member

horenmar commented Jan 6, 2017

This has been fixed a while back already, closing.

@horenmar horenmar closed this as completed Jan 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants