From 778e6151589205d5f232ef0478e5e52760b6eedc Mon Sep 17 00:00:00 2001 From: Paul Henning Date: Thu, 3 Jan 2019 09:45:27 -0700 Subject: [PATCH] [flang] Added preprocessor directives to limit the use of non-inline ExpressionBase::derived to GCC on Mac (inlined on all other platforms) Original-commit: flang-compiler/f18@b38b31909a4d30e3cfd77353d44ecff06ef425da Reviewed-on: https://github.com/flang-compiler/f18/pull/248 --- flang/lib/evaluate/expression.cc | 2 ++ flang/lib/evaluate/expression.h | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/flang/lib/evaluate/expression.cc b/flang/lib/evaluate/expression.cc index a89816a55d1f..ef780087c927 100644 --- a/flang/lib/evaluate/expression.cc +++ b/flang/lib/evaluate/expression.cc @@ -189,6 +189,7 @@ template DynamicType ArrayConstructor::GetType() const { return result.GetType(); } +#if defined(__APPLE__) && defined(__GNUC__) template typename ExpressionBase::Derived &ExpressionBase::derived() { return *static_cast(this); @@ -198,6 +199,7 @@ template const typename ExpressionBase::Derived &ExpressionBase::derived() const { return *static_cast(this); } +#endif template std::optional ExpressionBase::GetType() const { diff --git a/flang/lib/evaluate/expression.h b/flang/lib/evaluate/expression.h index 832a6baa3717..371369638ca2 100644 --- a/flang/lib/evaluate/expression.h +++ b/flang/lib/evaluate/expression.h @@ -68,8 +68,13 @@ public: private: using Derived = Expr; +#if defined(__APPLE__) && defined(__GNUC__) Derived &derived(); const Derived &derived() const; +#else + Derived &derived() { return *static_cast(this); } + const Derived &derived() const { return *static_cast(this); } +#endif public: template Derived &operator=(const A &x) {