[flang] Added preprocessor directives to limit the use of non-inline ExpressionBase<A>::derived to GCC on Mac (inlined on all other platforms)

Original-commit: flang-compiler/f18@b38b31909a
Reviewed-on: https://github.com/flang-compiler/f18/pull/248
This commit is contained in:
Paul Henning 2019-01-03 09:45:27 -07:00
parent b61b31dfcd
commit 778e615158
2 changed files with 7 additions and 0 deletions

View file

@ -189,6 +189,7 @@ template<typename T> DynamicType ArrayConstructor<T>::GetType() const {
return result.GetType();
}
#if defined(__APPLE__) && defined(__GNUC__)
template<typename A>
typename ExpressionBase<A>::Derived &ExpressionBase<A>::derived() {
return *static_cast<Derived *>(this);
@ -198,6 +199,7 @@ template<typename A>
const typename ExpressionBase<A>::Derived &ExpressionBase<A>::derived() const {
return *static_cast<const Derived *>(this);
}
#endif
template<typename A>
std::optional<DynamicType> ExpressionBase<A>::GetType() const {

View file

@ -68,8 +68,13 @@ public:
private:
using Derived = Expr<Result>;
#if defined(__APPLE__) && defined(__GNUC__)
Derived &derived();
const Derived &derived() const;
#else
Derived &derived() { return *static_cast<Derived *>(this); }
const Derived &derived() const { return *static_cast<const Derived *>(this); }
#endif
public:
template<typename A> Derived &operator=(const A &x) {