| Line | |
|---|
| 1 | // Copyright (C) 2003, Fernando Luis Cacciola Carballal. |
|---|
| 2 | // |
|---|
| 3 | // Use, modification, and distribution is subject to the Boost Software |
|---|
| 4 | // License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at |
|---|
| 5 | // http://www.boost.org/LICENSE_1_0.txt) |
|---|
| 6 | // |
|---|
| 7 | // See http://www.boost.org/lib/optional for documentation. |
|---|
| 8 | // |
|---|
| 9 | // You are welcome to contact the author at: |
|---|
| 10 | // fernando_cacciola@hotmail.com |
|---|
| 11 | // |
|---|
| 12 | #include "boost/optional.hpp" |
|---|
| 13 | |
|---|
| 14 | // |
|---|
| 15 | // THIS TEST SHOULD FAIL TO COMPILE |
|---|
| 16 | // |
|---|
| 17 | #if BOOST_WORKAROUND( BOOST_INTEL_CXX_VERSION, <= 700) // Intel C++ 7.0 |
|---|
| 18 | // Interl C++ 7.0 incorrectly accepts the initialization "boost::optional<int> opt = 3" |
|---|
| 19 | // even though the ctor is explicit (c.f. 12.3.1.2), so the test uses another form of |
|---|
| 20 | // copy-initialization: argument-passing (8.5.12) |
|---|
| 21 | void helper ( boost::optional<int> ) ; |
|---|
| 22 | void test_explicit_constructor() |
|---|
| 23 | { |
|---|
| 24 | helper(3) ; // ERROR: Ctor is explicit. |
|---|
| 25 | } |
|---|
| 26 | #else |
|---|
| 27 | void test_explicit_constructor() |
|---|
| 28 | { |
|---|
| 29 | boost::optional<int> opt = 3 ; // ERROR: Ctor is explicit. |
|---|
| 30 | } |
|---|
| 31 | #endif |
|---|
| 32 | |
|---|
| 33 | |
|---|
Note: See
TracBrowser
for help on using the repository browser.