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

ace_auto_ptr and std::auto_ptr both exist with C++17 and clang 10 on Manjaro Linux #1171

Closed
Viste opened this issue Aug 3, 2020 · 7 comments · Fixed by #1172
Closed

ace_auto_ptr and std::auto_ptr both exist with C++17 and clang 10 on Manjaro Linux #1171

Viste opened this issue Aug 3, 2020 · 7 comments · Fixed by #1172

Comments

@Viste
Copy link

Viste commented Aug 3, 2020

Version

ACE 6.5.10

Host machine and operating system

NAME="Manjaro Linux"
ID=manjaro
ID_LIKE=arch
BUILD_ID=rolling
PRETTY_NAME="Manjaro Linux"
ANSI_COLOR="32;2;24;144;200"
HOME_URL="https://manjaro.org/"
DOCUMENTATION_URL="https://wiki.manjaro.org/"
SUPPORT_URL="https://manjaro.org/"
BUG_REPORT_URL="https://bugs.manjaro.org/"
LOGO=manjarolinux

Target machine and operating system (if different from host)

same

Compiler name and version (including patch level)

clang --version
clang version 10.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

The $ACE_ROOT/ace/config.h file

/usr/include/ace/config.h

AREA/CLASS/EXAMPLE AFFECTED:

ACE_Auto_Ptr

The problem effects:

my application

Synopsis

my application build fails

Description

when i build my app i get this:

/usr/include/ace/Auto_Ptr.inl:88:1: fatal error: reference to 'auto_ptr' is ambiguous
auto_ptr<X>::operator-> () const
^
/usr/include/ace/Auto_Ptr.h:95:7: note: candidate found by name lookup is 'auto_ptr'
class auto_ptr : public ACE_Auto_Basic_Ptr<X>
      ^
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/10.1.0/../../../../include/c++/10.1.0/backward/auto_ptr.h:89:11: note: candidate found by name lookup is 'std::auto_ptr'
    class auto_ptr
          ^

Repeat by

git clone https://github.com/WarheadCore/WarheadCore.git
cd WarheadCore && mkdir build && cd build
cmake ../ -DCMAKE_INSTALL_PREFIX=/some/path-DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DTOOLS=1 -DSCRIPTS=1
make
@jwillemsen
Copy link
Member

jwillemsen commented Aug 4, 2020

With C++17 there shouldn't be a std::auto_ptr, see https://en.cppreference.com/w/cpp/memory/auto_ptr.

@jwillemsen jwillemsen changed the title Ace_auto_pter with C++17 and clang 10 ace_auto_ptr and std::auto_ptr both exist with C++17 and clang 10 on Manjaro Linux Aug 4, 2020
@jwillemsen
Copy link
Member

You should use std::unique_ptr in your application code with C++11 and newer

@Viste
Copy link
Author

Viste commented Aug 4, 2020

@jwillemsen I'd be happy to use std::unique_ptr instead of ACE_Auto_Ptr but their behavior is different.
when i release object(aptr.release();) from ACE_Auto_Ptr it is transmitted to session normally, but when i do same with std::unique_ptr i get nullptr in session maybe i miss something

With C++17 there shouldn't be a std::auto_ptr, see https://en.cppreference.com/w/cpp/memory/auto_ptr.

I know that but its come with ACE include in project :/ i guess its because ace builds without C++17, but project build with C+17

@jwillemsen
Copy link
Member

jwillemsen commented Aug 4, 2020

For the API of std::unique_ptr please check the C++ reference. Your standard C++ library shouldn't define std::auto_ptr when you enable C++17 support, ACE does provide its auto_ptr with C++17 support because we lack sponsoring to update all ACE/TAO examples/tests to use std::unique_ptr, it looks that causes now an issue on your system. Maybe you can look at why your linux distro provides std::auto_ptr with C++17 and report an issue there?

@jwillemsen
Copy link
Member

Ok, on https://gcc.gnu.org/onlinedocs/libstdc++/manual/status.html#status.iso.2017 I found that gcc didn't remove std::auto_ptr with C++17 so the ACE definition shouldn't be enabled, can create a pull request for this?

@jwillemsen
Copy link
Member

I have created PR #1172 which should solve the ambiguity. I would recommend you to update your application code to not use std::auto_ptr anymore.

@jwillemsen
Copy link
Member

See #2109, with C++17 ACE doesn't provide auto_ptr and its related macros anymore

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants