Skip to content

Conversation

AbigailBuccaneer
Copy link

Previously, the code tried to avoid a -Wdeprecated-declarations warning by avoiding std::auto_ptr (since #413). However, the implementation has two issues:

  1. It uses std::scoped_ptr, which as far as I can tell is a nonexistent type. std::unique_ptr is presumably what was meant.
  2. It avoids auto_ptr whenver we're using GCC6. This means we don't dodge warnings for GCC5 or clang (which also support C++11). It also means that using GCC6 in C++03 mode fails, because std::unique_ptr doesn't exist there.

This fixes both of these issues, using std::unique_ptr in C++11 (and MSVC2010) and above.

Tested on GCC 5.4.1, GCC 6.2.0 and Clang 5.0.0-svn300863 in both C++03 and C++11 modes.

scoped_ptr has never been a part of the C++ standard - perhaps it's been
confused with boost::scoped_ptr. Anyhow, std::unique_ptr is the
replacement for the now-deprecated std::auto_ptr.
Previously we only used it on GCC 6 to avoid deprecated declaration
warnings. Now we are proactive and use it whenever compiling as C++11
(or MSVC2010+).

It also moves the logic for deciding between unique_ptr and auto_ptr
into a single location in config.h.

This fixes some use cases that were previously broken, including:
* CXX=clang++ -std=c++11 -Werror=deprecated-declarations
* CXX=g++-6 -std=c++03 -Werror=deprecated-declarations
@cdunn2001
Copy link
Contributor

If anybody objects, we might have to revert. But it looks good to me.

@cdunn2001 cdunn2001 merged commit 3cde9a9 into open-source-parsers:0.y.z Apr 23, 2017
@AbigailBuccaneer AbigailBuccaneer deleted the gcc6-unique-ptr branch April 24, 2017 08:06
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

Successfully merging this pull request may close these issues.

2 participants