1 /*============================================================================= 2 Boost.Wave: A Standard compliant C++ preprocessor library 3 http://www.boost.org/ 4 5 Copyright (c) 2001-2012 Hartmut Kaiser. Distributed under the Boost 6 Software License, Version 1.0. (See accompanying file 7 LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 8 =============================================================================*/ 9 10 // Test, if function like macros are correctly expanded if used as object like 11 // macros 12 13 #define CAT(a, b) a ## b 14 #define ARGS (1, 2) 15 16 //R #line 18 "t_1_012.cpp" 17 //R CAT (1, 2) 18 CAT ARGS 19 20 #define INVOKE(macro) macro ARGS 21 22 //R #line 24 "t_1_012.cpp" 23 //R CAT (1, 2) 24 INVOKE(CAT) 25 26 #define EXPAND(x) x 27 28 //R #line 30 "t_1_012.cpp" 29 //R 12 30 EXPAND(CAT ARGS) 31 32 //H 10: t_1_012.cpp(13): #define 33 //H 08: t_1_012.cpp(13): CAT(a, b)=a ## b 34 //H 10: t_1_012.cpp(14): #define 35 //H 08: t_1_012.cpp(14): ARGS=(1, 2) 36 //H 01: t_1_012.cpp(14): ARGS 37 //H 02: (1, 2) 38 //H 03: (1, 2) 39 //H 10: t_1_012.cpp(20): #define 40 //H 08: t_1_012.cpp(20): INVOKE(macro)=macro ARGS 41 //H 00: t_1_012.cpp(24): INVOKE(CAT), [t_1_012.cpp(20): INVOKE(macro)=macro ARGS] 42 //H 02: CAT ARGS 43 //H 01: t_1_012.cpp(14): ARGS 44 //H 02: (1, 2) 45 //H 03: (1, 2) 46 //H 03: CAT (1, 2) 47 //H 10: t_1_012.cpp(26): #define 48 //H 08: t_1_012.cpp(26): EXPAND(x)=x 49 //H 00: t_1_012.cpp(30): EXPAND(CAT ARGS), [t_1_012.cpp(26): EXPAND(x)=x] 50 //H 01: t_1_012.cpp(14): ARGS 51 //H 02: (1, 2) 52 //H 03: (1, 2) 53 //H 02: CAT (1, 2) 54 //H 00: t_1_012.cpp(30): CAT(1, 2), [t_1_012.cpp(13): CAT(a, b)=a ## b] 55 //H 02: 12 56 //H 03: 12 57 //H 03: 12 58