Quantcast
Viewing all articles
Browse latest Browse all 1175

ICC 2017 Preprocessor bug with tokens concatenation

Hello. I'm found a bug with tokens concatenation. Simple example to reproduce:

#define test(x, y) sizeof(x##y)
#define test2(x, y) sizeof(##x##y)
int main()
{
	int a = test(in, t); // works fine
	int b = test2(in, t); // error
}

Compilation on windows (msvc integration):

1>  main.cpp
1>..\main.cpp(6): error : identifier "in" is undefined
1>    	int b = test2(in, t); // error
1>    	        ^
1>
1>..\main.cpp(6): error : expected a ")"
1>    	int b = test2(in, t); // error

Preprocessor output to file:

#line 1 "..\\main.cpp"

int main()
{
	int a = sizeof(int);
	int b = sizeof(int);
}

 

Thread Topic: 

Bug Report

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>