A syntax check problem of Clion Follow
Answered
I have a cpp file includes a header file "A.h", and A.h contains following code:
#pragma once
#include "B.h"
struct test
{
int x;
};
and B.h contains following code:
#pragma once
#include "A.h"
then, Clion will generate an error that struct "test" is redefinition in "A.h", but gcc 11 builds ok.
and, if I replace #pragma once with tranditional "#ifndef __XXX_H__ #define __XXX_H__ #endif", clion will not generate any error.
I think this may be a clion bug that analyzed file(especially header file) isn't regard as a part of "#pragma once"
Please sign in to leave a comment.
Hello!
Here is the related issue - https://youtrack.jetbrains.com/issue/CPP-16135. Feel free to comment or upvote it. 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.