blob: b0f026a6b443709579f0ba5fb6db7acd9d615f4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
// pp-bug-1.slang
//DIAGNOSTIC_TEST:SIMPLE:-E
// The bug in this case was related to a use-after-free
// where the list of "busy" macros for a function-like
// macro invocation was being set based on what was
// busy when reading the macro name, which could include
// streams that had been popped by the time arguments
// had been read.
#define NUM_CASES 2
#define X1(M) M(0)
#define X2(M) M(0) M(1)
#define CONCAT2(a, b) a##b
#define CONCAT(a, b) CONCAT2(a, b)
#define FOREACH(M) CONCAT(X, NUM_CASES)(M)
#define CASE(i) i
// Should output: 0 1
// Outputs: 0 CASE ( 1 )
FOREACH(CASE)
|