cppfront icon indicating copy to clipboard operation
cppfront copied to clipboard

[BUG] Cppfront doesn't check included .h2 'pureness'

Open realgdman opened this issue 2 years ago • 0 comments

Describe the bug Cppfront in -p mode doesn't check included .h2 for pureness

To Reproduce Evil example

  1. Sample code - distilled down to minimal essentials please m.cpp2
#include "m.h2"
main: () -> int = { std::cout << true; }

m.h2

#define true false
  1. Command lines including which C++ compiler you are using cppfront -pure-cpp2 m.cpp2 cppfront m.h2 clang++-16 -Icppfront/include m.cpp -std=c++20 -o m

Note I'm checking cpp2 for -p

(cppfront latest 083c8a0) 3. Expected result - what you expected to happen Well, I'm wishing for m.cpp2(1,1): error: pure-cpp2 switch disables the preprocessor 4. Actual result/error main.cpp2... ok (mixed Cpp1/Cpp2, Cpp2 code passes safety checks) Program prints 0 (false)

Additional context Granted, currently I'm using this for advantage, for example #defining wcout/cout according to platform.

realgdman avatar Nov 04 '23 05:11 realgdman