Skip to content

Build failure with GCC C++17 due to GNetPackage constructor #17385

@HiroyukiSakai

Description

@HiroyukiSakai
System information (version)
  • OpenCV => 4.3.0-dev (4.3.0-317-g4e97c69792)
  • Operating System / Platform => Linux 64 Bit
  • Compiler => GCC 7.5.0
Detailed description

Using the C++17 standard, the compiler exits due to the following error:

<path_to_opencv>/opencv/modules/gapi/include/opencv2/gapi/infer.hpp:188:35: error: constructor delegates to itself
     GNetPackage() : GNetPackage({}) {}

By reverting the fix for MSVS2017/2019 introduced by commit 5e527d2, the code compiles, however, this apparently breaks the build with MSVS2017/2019.
Concretely, one needs to change this part of infer.hpp

struct GAPI_EXPORTS GNetPackage {
    GNetPackage() : GNetPackage({}) {}
    explicit GNetPackage(std::initializer_list<GNetParam> &&ii);

back to

struct GAPI_EXPORTS GNetPackage {
    explicit GNetPackage(std::initializer_list<GNetParam> &&ii = {});
Steps to reproduce

These are the commands I've used, with the build directory residing in the OpenCV root directory.
I needed to build OpenEXR, as the version that was already installed on the system was out of date.

cmake -DCMAKE_CXX_STANDARD=17 -DBUILD_OPENEXR=ON ../
make -j16
Issue submission checklist
  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues,
    answers.opencv.org, Stack Overflow, etc and have not found solution
  • I updated to latest OpenCV version and the issue is still there
  • There is reproducer code and related data files: videos, images, onnx, etc

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions