Ticket #12431: test2.cpp

File test2.cpp, 887 bytes (added by mjtruog@…, 6 years ago)

test2.cpp

Line 
1// -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
2// ex: set softtabstop=4 tabstop=4 shiftwidth=4 expandtab:
3
4// g++ -Wall -Wextra -Werror -g -O0 -save-temps -o test2.o -c -fpic test2.cpp
5
6#include <boost/preprocessor/facilities/expand.hpp>
7#include <boost/preprocessor/tuple/push_front.hpp>
8#include <boost/preprocessor/seq/push_front.hpp>
9#include <boost/preprocessor/seq/to_tuple.hpp>
10#include <cstdio>
11
12#define TEST2_RESULT(NAME, I, J) NAME##I
13#define TEST2_WORKS \
14 BOOST_PP_EXPAND(\
15 TEST2_RESULT \
16 BOOST_PP_SEQ_TO_TUPLE(\
17 BOOST_PP_SEQ_PUSH_FRONT((0)(1), arg)\
18 )\
19 )
20#define TEST2_FAILS \
21 BOOST_PP_EXPAND(\
22 TEST2_RESULT \
23 BOOST_PP_TUPLE_PUSH_FRONT((0, 1), arg) \
24 )
25
26int main()
27{
28 double const arg0 = 1;
29 ::printf("%f\n", TEST2_WORKS);
30 ::printf("%f\n", TEST2_FAILS);
31 return 0;
32}