Skip to content

Conversation

@rkfg
Copy link
Contributor

@rkfg rkfg commented May 23, 2017

I have no idea why this compiles in GCC 5 and 6 in the first place (maybe this constructor is not used anywhere), but GCC 7 fails with this error:

In file included from /home/rkfg/soft/avcpp/src/codeccontext.cpp:7:0:
/home/rkfg/soft/avcpp/src/codeccontext.h: In constructor ‘av::CodecContextBase<Clazz, _direction, _type>::CodecContextBase(const av::Codec&)’:
/home/rkfg/soft/avcpp/src/codeccontext.h:313:39: error: no matching function for call to ‘av::CodecContextBase<Clazz, _direction, _type>::checkCodec(const av::Codec&, av::OptionalErrorCode)’
         if (checkCodec(codec, throws()))
                                       ^
/home/rkfg/soft/avcpp/src/codeccontext.h:132:10: note: candidate: bool av::CodecContext2::checkCodec(const av::Codec&, av::Direction, AVMediaType, av::OptionalErrorCode)
     bool checkCodec(const Codec& codec, Direction direction, AVMediaType type, OptionalErrorCode ec);
          ^~~~~~~~~~
/home/rkfg/soft/avcpp/src/codeccontext.h:132:10: note:   candidate expects 4 arguments, 2 provided

: CodecContext2(codec, _direction, _type)
{
if (checkCodec(codec, throws()))
if (checkCodec(codec, codec.canEncode() ? Direction::Encoding : Direction::Decoding, codec.type(), throws()))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Codec must be compatible with CodecContext, so it is incorrect to pass direction and type info taken from the codec itself. Just use _direction and _type template parameters as a function argument:

if (checkCodec(codec, _direction, _type, throws()))

@rkfg
Copy link
Contributor Author

rkfg commented May 23, 2017

Should be good now.

@h4tr3d h4tr3d merged commit 3a528a2 into h4tr3d:master May 24, 2017
@h4tr3d
Copy link
Owner

h4tr3d commented May 24, 2017

Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants