Skip to content

Commit 387e1bf

Browse files
derekmaurocopybara-github
authored andcommitted
Optional: Remove workaround for lack of support for inheriting constructors
PiperOrigin-RevId: 524368346 Change-Id: I68b57a1abc8d805aa5cb4b45c5d7449ade231579
1 parent 2ed3e75 commit 387e1bf

File tree

1 file changed

+0
-52
lines changed

1 file changed

+0
-52
lines changed

absl/types/internal/optional.h

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -25,34 +25,6 @@
2525
#include "absl/meta/type_traits.h"
2626
#include "absl/utility/utility.h"
2727

28-
// ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
29-
//
30-
// Inheriting constructors is supported in GCC 4.8+, Clang 3.3+ and MSVC 2015.
31-
// __cpp_inheriting_constructors is a predefined macro and a recommended way to
32-
// check for this language feature, but GCC doesn't support it until 5.0 and
33-
// Clang doesn't support it until 3.6.
34-
// Also, MSVC 2015 has a bug: it doesn't inherit the constexpr template
35-
// constructor. For example, the following code won't work on MSVC 2015 Update3:
36-
// struct Base {
37-
// int t;
38-
// template <typename T>
39-
// constexpr Base(T t_) : t(t_) {}
40-
// };
41-
// struct Foo : Base {
42-
// using Base::Base;
43-
// }
44-
// constexpr Foo foo(0); // doesn't work on MSVC 2015
45-
#if defined(__clang__)
46-
#if __has_feature(cxx_inheriting_constructors)
47-
#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
48-
#endif
49-
#elif (defined(__GNUC__) && \
50-
(__GNUC__ > 4 || __GNUC__ == 4 && __GNUC_MINOR__ >= 8)) || \
51-
(__cpp_inheriting_constructors >= 200802) || \
52-
(defined(_MSC_VER) && _MSC_VER >= 1910)
53-
#define ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS 1
54-
#endif
55-
5628
namespace absl {
5729
ABSL_NAMESPACE_BEGIN
5830

@@ -145,15 +117,7 @@ template <typename T>
145117
class optional_data_base : public optional_data_dtor_base<T> {
146118
protected:
147119
using base = optional_data_dtor_base<T>;
148-
#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
149120
using base::base;
150-
#else
151-
optional_data_base() = default;
152-
153-
template <typename... Args>
154-
constexpr explicit optional_data_base(in_place_t t, Args&&... args)
155-
: base(t, absl::forward<Args>(args)...) {}
156-
#endif
157121

158122
template <typename... Args>
159123
void construct(Args&&... args) {
@@ -188,27 +152,13 @@ class optional_data;
188152
template <typename T>
189153
class optional_data<T, true> : public optional_data_base<T> {
190154
protected:
191-
#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
192155
using optional_data_base<T>::optional_data_base;
193-
#else
194-
optional_data() = default;
195-
196-
template <typename... Args>
197-
constexpr explicit optional_data(in_place_t t, Args&&... args)
198-
: optional_data_base<T>(t, absl::forward<Args>(args)...) {}
199-
#endif
200156
};
201157

202158
template <typename T>
203159
class optional_data<T, false> : public optional_data_base<T> {
204160
protected:
205-
#ifdef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
206161
using optional_data_base<T>::optional_data_base;
207-
#else
208-
template <typename... Args>
209-
constexpr explicit optional_data(in_place_t t, Args&&... args)
210-
: optional_data_base<T>(t, absl::forward<Args>(args)...) {}
211-
#endif
212162

213163
optional_data() = default;
214164

@@ -399,6 +349,4 @@ struct optional_hash_base<T, decltype(std::hash<absl::remove_const_t<T> >()(
399349
ABSL_NAMESPACE_END
400350
} // namespace absl
401351

402-
#undef ABSL_OPTIONAL_USE_INHERITING_CONSTRUCTORS
403-
404352
#endif // ABSL_TYPES_INTERNAL_OPTIONAL_H_

0 commit comments

Comments
 (0)