Bug 142326 - GCC 11: error: invalid 'static_cast' from type 'std::__cxx11::basic_ostringstream<char>' to type 'std::ostringstream&' {aka 'std::__cxx11::basic_ostringstream<char>&'}
Summary: GCC 11: error: invalid 'static_cast' from type 'std::__cxx11::basic_ostringst...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: LibreOffice (show other bugs)
Version:
(earliest affected)
unspecified
Hardware: All All
: medium normal
Assignee: Stephan Bergmann
URL:
Whiteboard: target:7.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2021-05-17 09:44 UTC by Martin Liška
Modified: 2021-05-19 06:06 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Liška 2021-05-17 09:44:57 UTC
I noticed the following error when using the latest GCC release 11.1:

[ 4283s] In file included from /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:24:
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx: In member function 'sal_uInt16 SfxBindings::EnterRegistrations(const char*, int)':
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:194:6: error: invalid 'static_cast' from type 'std::__cxx11::basic_ostringstream<char>' to type 'std::ostringstream&' {aka 'std::__cxx11::basic_ostringstream<char>&'}
[ 4283s]   194 |     (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
[ 4283s]       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:129:45: note: in definition of macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_'
[ 4283s]   129 |             ::sal::detail::StreamStart() << stream) == 1) \
[ 4283s]       |                                             ^~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:335:5: note: in expansion of macro 'SAL_DETAIL_LOG_STREAM'
[ 4283s]   335 |     SAL_DETAIL_LOG_STREAM( \
[ 4283s]       |     ^~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1314:5: note: in expansion of macro 'SAL_INFO'
[ 4283s]  1314 |     SAL_INFO(
[ 4283s]       |     ^~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1319:19: note: in expansion of macro 'SAL_STREAM'
[ 4283s]  1319 |                 ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
[ 4283s]       |                   ^~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:194:6: error: invalid 'static_cast' from type 'std::__cxx11::basic_ostringstream<char>' to type 'std::ostringstream&' {aka 'std::__cxx11::basic_ostringstream<char>&'}
[ 4283s]   194 |     (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
[ 4283s]       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:134:49: note: in definition of macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_'
[ 4283s]   134 |                 ::sal::detail::StreamStart() << stream), \
[ 4283s]       |                                                 ^~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:335:5: note: in expansion of macro 'SAL_DETAIL_LOG_STREAM'
[ 4283s]   335 |     SAL_DETAIL_LOG_STREAM( \
[ 4283s]       |     ^~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1314:5: note: in expansion of macro 'SAL_INFO'
[ 4283s]  1314 |     SAL_INFO(
[ 4283s]       |     ^~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1319:19: note: in expansion of macro 'SAL_STREAM'
[ 4283s]  1319 |                 ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
[ 4283s]       |                   ^~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:194:6: error: invalid 'static_cast' from type 'std::__cxx11::basic_ostringstream<char>' to type 'std::ostringstream&' {aka 'std::__cxx11::basic_ostringstream<char>&'}
[ 4283s]   194 |     (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
[ 4283s]       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:138:30: note: in definition of macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_'
[ 4283s]   138 |         sal_detail_stream << stream; \
[ 4283s]       |                              ^~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:335:5: note: in expansion of macro 'SAL_DETAIL_LOG_STREAM'
[ 4283s]   335 |     SAL_DETAIL_LOG_STREAM( \
[ 4283s]       |     ^~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1314:5: note: in expansion of macro 'SAL_INFO'
[ 4283s]  1314 |     SAL_INFO(
[ 4283s]       |     ^~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1319:19: note: in expansion of macro 'SAL_STREAM'
[ 4283s]  1319 |                 ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
[ 4283s]       |                   ^~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:194:6: error: invalid 'static_cast' from type 'std::__cxx11::basic_ostringstream<char>' to type 'std::ostringstream&' {aka 'std::__cxx11::basic_ostringstream<char>&'}
[ 4283s]   194 |     (dynamic_cast< ::std::ostringstream & >(::std::ostringstream() << stream).str())
[ 4283s]       |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:129:45: note: in definition of macro 'SAL_DETAIL_LOG_STREAM_PRIVATE_'
[ 4283s]   129 |             ::sal::detail::StreamStart() << stream) == 1) \
[ 4283s]       |                                             ^~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/include/sal/log.hxx:335:5: note: in expansion of macro 'SAL_DETAIL_LOG_STREAM'
[ 4283s]   335 |     SAL_DETAIL_LOG_STREAM( \
[ 4283s]       |     ^~~~~~~~~~~~~~~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1314:5: note: in expansion of macro 'SAL_INFO'
[ 4283s]  1314 |     SAL_INFO(
[ 4283s]       |     ^~~~~~~~
[ 4283s] /home/abuild/rpmbuild/BUILD/libreoffice-7.1.3.2/sfx2/source/control/bindings.cxx:1319:19: note: in expansion of macro 'SAL_STREAM'
[ 4283s]  1319 |                 ? SAL_STREAM("File: " << pFile << " Line: " << nLine) : ""));
[ 4283s]       |                   ^~~~~~~~~~
Comment 2 Martin Liška 2021-05-17 10:41:37 UTC
(In reply to Julien Nabet from comment #1)
> Did you take a look at
> https://wiki.documentfoundation.org/Development/BuildingOnLinux ?
> Specifically
> https://wiki.documentfoundation.org/Development/
> BuildingOnLinux#Build_dependencies ?

No, what do I miss?
We're building the package in https://build.opensuse.org/
Comment 3 Julien Nabet 2021-05-17 11:03:55 UTC
Sorry I didn't know that you were the package manager of OpenSuse.

Could you provide config option/autogen.input you use?

So you've got an error with 7.1.3.2 but just for curiosity what was the previous version which built, 7.1.2? 7.1.1?

As for me, no pb to build LO master sources (future 7.2.0) on pc Debian x86-64 testing updated today.
I searched about SAL_ in git log, I got:
git log --follow -S  'SAL_' sfx2/source/control/bindings.cxx
commit d6a8934eeb192b8a2d672bfc6b90ee2b333841ae
Author: Stephan Bergmann <sbergman@redhat.com>
Date:   Tue Nov 22 16:56:08 2011 +0100

    Remove no longer necessary "(void) x; // avoid warnings".

So nothing new here.

Rene: as package manager for Debian, any idea which may help Martin here?
Comment 4 Julien Nabet 2021-05-17 12:09:24 UTC
BTW, it's not related to Base part.

Also, you may use LO Dev forum or IRC.
Comment 5 Martin Liška 2021-05-17 16:08:28 UTC
It's fixed in master with:
https://cgit.freedesktop.org/libreoffice/core/commit/?id=1f3dddd6f21d91c429190ae314dadeec409f35f4

but the commit addresses only GCC >= 12.

@Stephan: Can you please take a look?
Comment 6 Martin Liška 2021-05-17 16:16:15 UTC
Or there's an alternative fix:
https://bugzilla.suse.com/show_bug.cgi?id=1186110#c5
Comment 7 Commit Notification 2021-05-19 05:28:42 UTC
Stephan Bergmann committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/95e26d3dce4f5a3b2d010d5ca47b4e450905a100

tdf#142326: Adapt to "libstdc++: Implement LWG 1203 for rvalue iostreams"

It will be available in 7.2.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.