Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Disable binding ref to temporaries when rvalue references are supported
- Loading branch information
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright 2002-2004 David Abrahams and Aleksey Gurtovoy | ||
// Copyright 2014 Agustin Berge | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See | ||
// accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <boost/ref.hpp> | ||
|
||
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | ||
|
||
int main() | ||
{ | ||
boost::reference_wrapper<int const> r(1); // this should produce an ERROR | ||
|
||
return 0; | ||
} | ||
|
||
# else | ||
# error To fail, this test requires rvalue references | ||
# endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Copyright 2002-2004 David Abrahams and Aleksey Gurtovoy | ||
// Copyright 2014 Agustin Berge | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See | ||
// accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <boost/ref.hpp> | ||
|
||
int main() | ||
{ | ||
boost::reference_wrapper<int> r = boost::ref(2); // this should produce an ERROR | ||
|
||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2002-2004 David Abrahams and Aleksey Gurtovoy | ||
// Copyright 2014 Agustin Berge | ||
// | ||
// Distributed under the Boost Software License, Version 1.0. (See | ||
// accompanying file LICENSE_1_0.txt or copy at | ||
// http://www.boost.org/LICENSE_1_0.txt) | ||
|
||
#include <boost/ref.hpp> | ||
|
||
# if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) | ||
|
||
struct X {}; | ||
|
||
X const crv() { return X(); } | ||
|
||
int main() | ||
{ | ||
boost::reference_wrapper<X const> r = boost::ref(crv()); // this should produce an ERROR | ||
|
||
return 0; | ||
} | ||
|
||
# else | ||
# error To fail, this test requires rvalue references | ||
# endif |