Menu

#33 tclap does not compile with g++ 11

1.2.x
closed
None
5
2021-11-03
2021-05-28
peckato1
No

Hello, we have run into an issue after updating our stack.
The new g++-11 (v11.1) fails to compile tclap 1.2 and even 1.4 in C++20 mode due to, I guess, an incorrect syntax used to prevent accidental copying of ValueArg, MultiArg. The syntax should be:

MultiArg(const MultiArg<T>& rhs); 
MultiArg& operator=(const MultiArg<T>& rhs);

Alternatively, these could be set to delete with C++11's syntax.

The error

In file included from /usr/include/tclap/UnlabeledValueArg.h:30,
                 from /usr/include/tclap/CmdLine.h:29,
                 from ../aql2/src/aql.cpp:27:
/usr/include/tclap/ValueArg.h:243:20: error: expected unqualified-id before const
  243 |        ValueArg<T>(const ValueArg<T>& rhs);
      |                    ^~~~~
/usr/include/tclap/ValueArg.h:243:20: error: expected ) before const
  243 |        ValueArg<T>(const ValueArg<T>& rhs);
      |                   ~^~~~~
      |                    )
In file included from /usr/include/tclap/UnlabeledMultiArg.h:29,
                 from /usr/include/tclap/CmdLine.h:30,
                 from ../aql2/src/aql.cpp:27:
/usr/include/tclap/MultiArg.h:228:21: error: expected unqualified-id before const
  228 |         MultiArg<T>(const MultiArg<T>& rhs);
      |                     ^~~~~
/usr/include/tclap/MultiArg.h:228:21: error: expected ) before const
  228 |         MultiArg<T>(const MultiArg<T>& rhs);
      |                    ~^~~~~
      |                     )
[7/8] Building CXX object aql2/CMakeFiles/aql2.dir/src/prompt/ReadlinePromptCompletion.cpp.o
ninja: build stopped: subcommand failed.

See https://godbolt.org/z/94rv41aPe
The issue was created by travnja3 who accidentaly sent it to https://github.com/mirror/tclap/issues/7 ;)

Discussion

  • Daniel Aarno

    Daniel Aarno - 2021-06-06
    • assigned_to: Daniel Aarno
     
  • Daniel Aarno

    Daniel Aarno - 2021-06-06
    • status: open --> closed
     
  • Daniel Aarno

    Daniel Aarno - 2021-06-06

    Fixed in [b8e464] for 1.4, and [52a118] for 1.2.

     

    Related

    Commit: [b8e464]
    Commit: [52a118]

  • peckato1

    peckato1 - 2021-10-27

    Is it possible to perform a version bump in 1.2 branch so that distro packagers gets notified and package the new fixed version?

     
  • Daniel Aarno

    Daniel Aarno - 2021-11-03

    Done, I've cut a new 1.2.5 release that should compile with GCC 11

     

Log in to post a comment.