The constexpr-capable class evaluate::DynamicType represented
CHARACTER length only with a nullable pointer into the declared
parameters of types in the symbol table, which works fine for
anything with a declaration but turns out to not suffice to
describe the results of the ACHAR() and CHAR() intrinsic
functions. So extend DynamicType to also accommodate known
constant CHARACTER lengths, too; use them for ACHAR & CHAR;
clean up several use sites and fix regressions found in test.
Details
Details
Diff Detail
Diff Detail
Event Timeline
Comment Actions
FYI, this change broke compiling flang with GCC 7 on Ubuntu 18.04, with build errors like these:
In file included from /home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/call.h:12:0,
from /home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/intrinsics.h:12,
from /home/ubuntu/code/llvm-project/flang/lib/Evaluate/intrinsics.cpp:9:
/home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/common.h:187:16: error: explicitly defaulted function ‘constexpr Fortran::evaluate::DynamicType& Fortran::evaluate::DynamicType::operator=(const Fortran::evaluate::DynamicType&)’ cannot be declared as constexpr because the implicit declaration is not constexpr:
constexpr t &operator=(const t &) = default; \
^
/home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/type.h:103:3: note: in expansion of macro ‘CONSTEXPR_CONSTRUCTORS_AND_ASSIGNMENTS’
CONSTEXPR_CONSTRUCTORS_AND_ASSIGNMENTS(DynamicType)
^
In file included from /usr/include/c++/7/bits/node_handle.h:39:0,
from /usr/include/c++/7/bits/hashtable.h:37,
from /usr/include/c++/7/unordered_map:47,
from /usr/include/c++/7/functional:60,
from /home/ubuntu/code/llvm-project/flang/include/flang/Common/idioms.h:27,
from /home/ubuntu/code/llvm-project/flang/include/flang/Common/Fortran.h:15,
from /home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/common.h:12,
from /home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/call.h:12,
from /home/ubuntu/code/llvm-project/flang/include/flang/Evaluate/intrinsics.h:12,
from /home/ubuntu/code/llvm-project/flang/lib/Evaluate/intrinsics.cpp:9:
/usr/include/c++/7/optional:453:11: note: defaulted constructor calls non-constexpr ‘std::optional<long int>& std::optional<long int>::operator=(const std::optional<long int>&)’
class optional
^~~~~~~~
/usr/include/c++/7/optional:453:11: note: ‘std::optional<long int>& std::optional<long int>::operator=(const std::optional<long int>&)’ is not usable as a constexpr function because:
/usr/include/c++/7/optional:351:7: note: defaulted constructor calls non-constexpr ‘std::_Optional_base<_Tp>& std::_Optional_base<_Tp>::operator=(const std::_Optional_base<_Tp>&) [with _Tp = long int]’
operator=(const _Optional_base& __other)
^~~~~~~~Comment Actions
I'll see whether there's a patch that can work around those old compilers. Thanks for the notification.
clang-tidy: warning: do not use 'else' after 'return' [llvm-else-after-return]
not useful