adishavit / argh

Argh! A minimalist argument handler.
BSD 3-Clause "New" or "Revised" License
1.33k stars 93 forks source link

doctest.h:1398:92: error: use of deleted function #72

Closed tillea closed 2 years ago

tillea commented 2 years ago

Hi, the Debian packaged version of argh received a bug report which says:

    In file included from /<<PKGBUILDDIR>>/argh_tests.cpp:4:
    /usr/include/doctest/doctest.h: In instantiation of ‘doctest::detail::Expression_lhs<const L> doctest::detail::ExpressionDecomposer::operator<<(const L&&) [with L = std::__cxx11::  basic_istringstream<char>]’:
    /<<PKGBUILDDIR>>/argh_tests.cpp:62:5:   required from here
    /usr/include/doctest/doctest.h:1398:92: error: use of deleted function ‘doctest::detail::Expression_lhs<const std::__cxx11::basic_istringstream<char> >::Expression_lhs(doctest::    detail::Expression_lhs<const std::__cxx11::basic_istringstream<char> >&&)’
     1398 |             return Expression_lhs<const L>(doctest::detail::forward<const L>(operand), m_at);
          |                                                                                            ^
    In file included from /<<PKGBUILDDIR>>/argh_tests.cpp:4:
    /usr/include/doctest/doctest.h:1317:12: note: ‘doctest::detail::Expression_lhs<const std::__cxx11::basic_istringstream<char> >::Expression_lhs(doctest::detail::Expression_lhs<const std::__cxx11::basic_istringstream<char> >&&)’ is implicitly deleted because the default definition would be ill-formed:
     1317 |     struct Expression_lhs
          |            ^~~~~~~~~~~~~~
    /usr/include/doctest/doctest.h:1317:12: error: use of deleted function ‘std::__cxx11::basic_istringstream<_CharT, _Traits, _Alloc>::basic_istringstream(const std::__cxx11::         basic_istringstream<_CharT, _Traits, _Alloc>&) [with _CharT = char; _Traits = std::char_traits<char>; _Alloc = std::allocator<char>]’
    In file included from /<<PKGBUILDDIR>>/argh.h:4,
                     from /<<PKGBUILDDIR>>/argh_tests.cpp:1:
    /usr/include/c++/11/sstream:619:7: note: declared here
      619 |       basic_istringstream(const basic_istringstream&) = delete;
          |       ^~~~~~~~~~~~~~~~~~~
    [ 75%] Linking CXX executable argh_example

Any idea how to fix this? Kind regards, Andreas.

adishavit commented 2 years ago

I have no idea what this may be - nor do I have a way to repro. @onqtam - can you take a look? Any suggestions?

onqtam commented 2 years ago

I'm no longer working on doctest and have been superseded by a different maintainer, but from a quick glance I see that argh is still using doctest 1.2.2 which is almost 5 years old - I'd suggest trying with the latest version and reporting back if that fixes the problem (because this error doesn't ring a bell).

doctest has been changed quite a lot in the last couple of years but the interface is 100% the same so upgrading should be painless. doctest 2.x requires C++11 though...

tillea commented 2 years ago

Hi,

Am Fri, Mar 18, 2022 at 01:13:02AM -0700 schrieb Viktor Kirilov:

I'm no longer working on doctest and have been superseded by a different maintainer, but from a quick glance I see that argh is still using doctest 1.2.2 which is almost 5 years ago - I'd suggest trying with the latest version and reporting back if that fixes the problem (because this error doesn't ring a bell).

doctest has been changed quite a lot in the last couple of years but the interface is 100% the same so upgrading should be painless.

Hmmm, since you are mentioning doctest: I'm not using the bundled doctest inside the Debian package. doctest.h is excluded and I'm rather using the Debian packaged version (2.4.8) to build the package.

Kind regards, Andreas.

onqtam commented 2 years ago

Can you provide a minimal reproducible example that includes both frameworks and has this problem? From what I can tell this is not the argh_tests.cpp source file in this repository because it seems to be including the doctest.h version that is in this repository with #include "doctest.h" instead of with <>. Also compiler version would be very helpful. Thanks!

nileshpatra commented 2 years ago

Can you provide a minimal reproducible example that includes both frameworks and has this problem? From what I can tell this is not the argh_tests.cpp source file in this repository because it seems to be including the doctest.h version that is in this repository with #include "doctest.h" instead of with <>.

Yes, you are right. That's been patched to use doctest.h from our respositories and the version for doctest in debian is 2.4.8 while the embedded one in the argh repository is still sitting at an outdated version. This is why it fails. Easy way to reproduce this would be if you copy the doctest.h file for 2.4.8 or any later version in the argh repository and then trigger the test.

Also compiler version would be very helpful.

We are on gcc-12 hope that helps.

adishavit commented 2 years ago

Please try dropping in the latest version 2.4.8 instead.
If all runs well - make a PR. Let me know if you have trouble with it and I'll do it. Just a bit busy lately.

nileshpatra commented 2 years ago

Please try dropping in the latest version 2.4.8 instead. If all runs well - make a PR.

Not sure if you mean somthing else, but does not run well with the latest version, and that's what this bug report/issue is about. The failing logs are here as posted initially as well.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005500

onqtam commented 2 years ago

This is indeed a problem with doctest and it was introduced in version 2.4.7 (clang has no problems but all versions of gcc give an error) - this sample reproduces it: https://godbolt.org/z/5Y87aMW8W

I'll take a look

adishavit commented 2 years ago

As per @onqtam 's suggestion, I pushed version 2.4.6. @tillea LMK if the problem is fixed.

onqtam commented 2 years ago

@adishavit they are not using the version of doctest that's in this repository - instead, they are using the latest published doctest version (not sure why) which has introduced this bug. Still not fixed on my end.

Logged it on my end - watch this issue if anyone is interested: https://github.com/doctest/doctest/issues/630

adishavit commented 2 years ago

Thanks @onqtam. I understand. I a closing this issue for now, as it is no longer an argh issue. Thanks everyone for investigating.

nileshpatra commented 2 years ago

On Sun, 20 Mar, 2022, 9:23 pm Adi Shavit, @.***> wrote:

Please try dropping in the latest version 2.4.8 https://github.com/doctest/doctest/blob/master/doctest/doctest.h instead. If all runs well - make a PR.

Not sure if you mean somthing else, but does not run well with the latest version, and that's what this bug report/issue is about. The failing logs are here as posted initially as well.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1005500

onqtam commented 2 years ago

@nileshpatra I don't have much time to look at this again but it seems that the issue was fixed not in version 2.4.8 of doctest but in version 2.4.9 - use this godbolt link to test different version (can confirm that with 2.4.9 or the latest master it works properly):

https://godbolt.org/z/vEYo3xaP4

onqtam commented 2 years ago

according to the changelog this issue (also logged in doctest as issue introduced in 2.4.7: https://github.com/doctest/doctest/issues/630) was fixed in v2.4.9 and not in v2.4.8: https://github.com/doctest/doctest/blob/master/CHANGELOG.md#v249-2022-06-18