Skip to content

#pragma once does not work if files referenced by alternate paths #714

@mmastrac

Description

@mmastrac

Repro attached.

test.c:

#include "base.h"
#include "x/inc.h"

base.h:

#pragma once
struct foo {
        int bar;
};

x/inc.h

#pragma once
#include "../base.h"

Using 2021-05-01 build.

Expected result: successful compile (works in gcc/llvm)
Actual result: /home/x/../base.h(3): Error! E1019: Tag 'foo' already defined
Workaround: #ifdef guards

repro.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions