diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2022-10-25 14:10:23 +0200 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2022-10-25 15:55:06 +0200 |
commit | 16045087e6541925be340d585e68a35147489b59 (patch) | |
tree | 73c315ca4f1728ccadd195b6c69074ede87b74d7 /basic | |
parent | 9ff56812741029ad17204cff53357751687d9b6c (diff) |
Address a constexpr template point of instantiation issue
...that hits at least when building with Clang and --with-latest-c++ against
recent libc++ or MSVC standard library (where C++20 and esp. C++23 made more and
more class template member functions constexpr). My understanding is that there
is some leeway at what point a compiler should instantiate such function
specializations, and Clang decides to instantiate constexpr ones early (cf.
<https://github.com/llvm/llvm-project/commit/242ad89a15d5466d166d47978bfff983d40ab511>
"C++11 half of r147023: In C++11, additionally eagerly instantiate:" and its "Do
not defer instantiations of constexpr functions" comment, and the discussion at
<https://discourse.llvm.org/t/point-of-instantiation-of-constexpr-function-template/65129>).
> In file included from basic/source/comp/codegen.cxx:21:
> In file included from include/basic/sberrors.hxx:23:
> In file included from include/vcl/errcode.hxx:23:
> In file included from include/rtl/ustring.hxx:34:
> In file included from ~/llvm/inst/bin/../include/c++/v1/ostream:168:
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:47:19: error: invalid application of 'sizeof' to an incomplete type 'SbiExprList'
> static_assert(sizeof(_Tp) >= 0, "cannot delete an incomplete type");
> ^~~~~~~~~~~
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:281:7: note: in instantiation of member function 'std::default_delete<SbiExprList>::operator()' requested here
> __ptr_.second()(__tmp);
> ^
> ~/llvm/inst/bin/../include/c++/v1/__memory/unique_ptr.h:247:75: note: in instantiation of member function 'std::unique_ptr<SbiExprList>::reset' requested here
> _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
> ^
> basic/source/inc/expr.hxx:118:66: note: in instantiation of member function 'std::unique_ptr<SbiExprList>::~unique_ptr' requested here
> SbiExprNode( const SbiSymDef&, SbxDataType, SbiExprListPtr = nullptr );
> ^
> basic/source/inc/expr.hxx:30:7: note: forward declaration of 'SbiExprList'
> class SbiExprList;
> ^
Change-Id: I3bde85164ae6b829b7c24d9645fd412ed3fd815d
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/141810
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/source/inc/expr.hxx | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/basic/source/inc/expr.hxx b/basic/source/inc/expr.hxx index d5130c39dae9..d1e7fbcfa25d 100644 --- a/basic/source/inc/expr.hxx +++ b/basic/source/inc/expr.hxx @@ -85,6 +85,25 @@ enum RecursiveMode PREVENT_CALL }; +class SbiExprList final { // class for parameters and dims + std::vector<std::unique_ptr<SbiExpression>> aData; + short nDim; + bool bError; + bool bBracket; +public: + SbiExprList(); + ~SbiExprList(); + static SbiExprListPtr ParseParameters(SbiParser*, bool bStandaloneExpression = false, bool bPar = true); + static SbiExprListPtr ParseDimList( SbiParser* ); + bool IsBracket() const { return bBracket; } + bool IsValid() const { return !bError; } + short GetSize() const { return aData.size(); } + short GetDims() const { return nDim; } + SbiExpression* Get( size_t ); + void Gen( SbiCodeGen& rGen); // code generation + void addExpression( std::unique_ptr<SbiExpression>&& pExpr ); +}; + class SbiExprNode final { // operators (and operands) friend class SbiExpression; friend class SbiConstExpression; @@ -205,23 +224,4 @@ public: // numeric constant short GetShortValue(); }; -class SbiExprList final { // class for parameters and dims - std::vector<std::unique_ptr<SbiExpression>> aData; - short nDim; - bool bError; - bool bBracket; -public: - SbiExprList(); - ~SbiExprList(); - static SbiExprListPtr ParseParameters(SbiParser*, bool bStandaloneExpression = false, bool bPar = true); - static SbiExprListPtr ParseDimList( SbiParser* ); - bool IsBracket() const { return bBracket; } - bool IsValid() const { return !bError; } - short GetSize() const { return aData.size(); } - short GetDims() const { return nDim; } - SbiExpression* Get( size_t ); - void Gen( SbiCodeGen& rGen); // code generation - void addExpression( std::unique_ptr<SbiExpression>&& pExpr ); -}; - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |