Open StephanTLavavej opened 11 months ago
CC @AaronBallman @cor3ntin
@llvm/issue-subscribers-clang-frontend
Author: Stephan T. Lavavej (StephanTLavavej)
This recently came up in WG21 as part of P2843 and https://github.com/cplusplus/papers/issues/1413
The undefined behavior in the spec is how historically C allowed implementation divergence.
I think we should wait for WG21 to decide whether specific directives should be allowed/removed. If my recall is correct, clang is consistent with GCC. Adding a warning now might lead to too much churn and noise.
I struggle to find the minutes of that specific discussion though.
@erichkeane
@cor3ntin : all of the discussion on that paper happened in "SG12", so we put it on that wiki: https://wiki.edg.com/bin/view/Wg21kona2023/SG12
N4964 [cpp.replace.general]/13:
When preprocessing directives are embedded in function-like macro arguments, MSVC appears to reject with its traditional (horribly deficient) preprocessor, and emits a dedicated warning with its modern (more conformant) preprocessor (and then later rejects, at least some of the time). Clang appears to silently accept, which is surprising.
This allowed UB to accumulate in libc++'s test suite, see #73440.