Skip to content

bootstrap: Require compiler mode aware of C++11

Brad King requested to merge brad.king/cmake:bootstrap-AppleClang-std into master

Some compilers have enough features enabled in their default modes to pass our simple C++11 unique_ptr check but do not enable enough to build CMake. Poison this case so that we choose one of the explicit -std= options for such compilers.

$ sunCC -V
CC: Sun C++ 5.13 SunOS_sparc 2014/10/20

$ cat sunpro-5.13-cxx11-move-bug.cxx
#include <iostream>

class A
{
public:
  A() { std::cerr << "A::A()\n"; }
  A(const A&) { std::cerr << "A::A(const A&)\n"; }
  A(A&&) { std::cerr << "A::A(A&&)\n"; }
  ~A() { std::cerr << "A::~A()\n"; }
};

class B
{
  A a_;
public:
  A const& get_a() const { return a_; }
};

A f(A const& a)
{
  return a;
}

int main()
{
  B b;
  f(b.get_a());
  return 0;
}

$ sunCC -std=c++11 sunpro-5.13-cxx11-move-bug.cxx && ./a.out
A::A()
A::A(A&&)
A::~A()
A::~A()

$ g++-4.9 --version
g++-4.9 (GCC) 4.9.2

$ g++-4.9 -std=c++11 sunpro-5.13-cxx11-move-bug.cxx && ./a.out
A::A()
A::A(const A&)
A::~A()
A::~A()

Topic-rename: bootstrap-std

Edited by Brad King

Merge request reports