Error "Function is not implememt" for override functions

Answered
#include <iostream>

struct BaseClass {
virtual ~BaseClass() {}

virtual void M () __attribute__((nothrow)) {
std::cout << "base" << std::endl;
}
};


class DerivedClass final : public BaseClass {

public:
virtual ~DerivedClass() {}

void M() override __attribute__((nothrow)) {
std:: cout << "derived x" << std::endl;
}

};

int main() {
DerivedClass d;
d.M();
return 0;
}

I have the above code, CLion reports error "Function M is not implememt". However I can compile and run the program correctly. I cannot change my code because the code is an extraction from a large project where all override functions are declared in the format of "override __attribute__((...))".

How do I make CLion inspection reporting errors consistent with the compiler?

0
1 comment

Hi!

I've created https://youtrack.jetbrains.com/issue/CPP-16461, feel free to comment or upvote in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.

Meanwhile you can disable or suppress the related inspection (File | Settings | Editor | Inspections | C/C++ | Functions | Not implemented functions).

Sorry for the inconvenience. 

0

Please sign in to leave a comment.