Quantcast
Channel: Intel® C++-Compiler
Viewing all articles
Browse latest Browse all 1665

C++ Compiler 15.0, initializer syntax issue

$
0
0

The following example code produces the compiler error "c:/temp/test.cpp(12): error #453: protected function "C1::C1(int)" (declared at line 4) is not accessible through a "C1" pointer or object" using command line "icpc.exe -std=c++11 c:\temp\test.cpp".

class C1
{
protected:
    C1(int a)
    {
    }
};

class C2 : public C1
{
public:
    C2() : C1{2}
    {
    }
};

It compiles if we change initializer syntax in line

    C2() : C1{2}

to constructor syntax

    C2() : C1(2)

Is this a bug? Thank you for clarification in advance.


Viewing all articles
Browse latest Browse all 1665

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>