Diagnostic 341: inherited member is not allowed

Cause:

This error occurs when you try to refer to a Base class inherited member with the Derived class qualifier.

Example:

class Base {
public:
void f();
};

class Derived: public Base {
};

void Derived::f() {;}   // error: f is not declared inside Derived

class C {
friend void Derived::f(); // error: f is not declared inside Derived
};

$ icc -c -V diag341.cpp
Intel® C Intel® 64 Compiler Professional for applications running on Intel® 64, Version 11.0    Build 20090318 Package ID: l_cproc_p_11.0.083
Copyright (C) 1985-2009 Intel Corporation.  All rights reserved.

diag341.cpp(9): error: inherited member is not allowed
void Derived::f() {;}
^

diag341.cpp(12): error: inherited member is not allowed
friend void Derived::f();
^

Resolution Status:

Either reference the class member using the Base class qualifier or override the Base class member with the  member inside the Derived class.
For more complete information about compiler optimizations, see our Optimization Notice.

2 comments

Top
Jennifer J. (Intel)'s picture

There're many diagnostics and are growing as we speak emitted from our compiler. Those empty pages with high hit or comments will be on top of our list. This helps us prioritize our work.

anonymous's picture

Delete this page until content is available !

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.