2 // { dg-do compile { target c++11 } }
3 // { dg-options "-O2" }
9 basic_cstring (char *);
11 template <typename> struct identity
15 struct function_buffer
18 template <typename FunctionObj> struct function_obj_invoker0
21 invoke (function_buffer &)
27 template <typename FunctionObj> struct get_function_obj_invoker0
29 typedef function_obj_invoker0<FunctionObj> type;
31 template <typename FunctionObj> struct apply
33 typedef typename get_function_obj_invoker0<FunctionObj>::type invoker_type;
37 typedef int (*invoker_type)(function_buffer &);
38 template <typename F> void assign_to (F, function_buffer);
44 template <typename Functor> function0 (Functor)
46 typedef typename apply<Functor>::invoker_type invoker_type;
47 basic_vtable0 stored_vtable { invoker_type::invoke };
48 stored_vtable.assign_to (0, functor);
50 function_buffer functor;
52 class function : function0
55 template <typename Functor> function (Functor f) : function0 (f) {}
57 class test_unit_generator
63 test_case (basic_cstring, basic_cstring, int, function);
65 struct auto_test_unit_registrar
67 auto_test_unit_registrar (test_unit_generator);
69 template <typename F> F unwrap (F, int);
72 template <typename Iterator, typename LastIterator, typename TransformFunc,
75 execute (Iterator, LastIterator, TransformFunc, F f)
77 identity<char> __trans_tmp_1;
78 unwrap (f, 0)(__trans_tmp_1);
81 template <typename, typename, typename F>
85 for_each_impl::execute (0, 0, 0, f);
87 template <typename TestCaseTemplate> class test_case_template_invoker
92 TestCaseTemplate::run (0);
95 template <typename Generator, typename TestCaseTemplate>
96 struct generate_test_case_4_type
98 generate_test_case_4_type (basic_cstring, basic_cstring, int, Generator G)
99 : m_test_case_name (0), m_test_case_file (0), m_holder (G)
102 template <typename TestType> void operator()(identity<TestType>)
104 test_case (0, 0, 0, test_case_template_invoker<TestCaseTemplate> ());
106 basic_cstring m_test_case_name;
107 basic_cstring m_test_case_file;
110 template <typename TestCaseTemplate>
111 class template_test_case_gen : public test_unit_generator
114 template_test_case_gen (basic_cstring, basic_cstring, int)
116 for_each<int, make_identity> (
117 generate_test_case_4_type<template_test_case_gen, TestCaseTemplate> (
126 attribute_name (char);
128 template <typename> struct term;
130 template <typename> struct expr;
133 template <typename T> struct Trans_NS_proto_terminal
135 typedef expr<term<T> > type;
138 template <typename Arg0> struct expr<term<Arg0> >
143 template <typename Expr> struct actor
145 typename Trans_NS_proto_terminal<Expr>::type proto_expr_;
147 template <template <typename> class Actor = actor> struct terminal
149 typedef Actor<int> type;
155 class value_extractor;
156 template <typename, typename = value_extractor, typename = void,
157 template <typename> class = actor>
158 class attribute_actor;
159 class attribute_terminal
162 attribute_name m_name;
169 template <typename, typename, typename, template <typename> class ActorT>
170 class attribute_actor : ActorT<attribute_terminal>
173 typedef int value_type;
177 return this->proto_expr_.child0.get_name ();
180 template <typename AttributeValueT>
181 attribute_actor<AttributeValueT> attr (attribute_name); // { dg-warning "used but never defined" }
182 terminal<>::type stream;
183 template <typename LeftT, typename ImplT> class attribute_output_terminal
186 template <typename U>
187 attribute_output_terminal (LeftT, attribute_name, ImplT, U);
189 template <typename LeftT> struct make_output_expression
191 typedef attribute_output_terminal<LeftT, to_log_fun> type;
192 template <typename RightT>
194 make (LeftT left, RightT &right)
196 type (left, right.get_name (), to_log_fun (), 0);
199 template <typename, typename RightT, typename = typename RightT::value_type>
200 struct make_output_actor;
201 template <template <typename> class ActorT, typename LeftExprT,
202 typename RightT, typename ValueT>
203 struct make_output_actor<ActorT<LeftExprT>, RightT, ValueT>
205 typedef make_output_expression<ActorT<LeftExprT> > make_expression;
206 typedef ActorT<typename make_expression::type> type;
208 make (ActorT<LeftExprT> left, RightT &right)
210 type { make_expression::make (left, right) };
213 template <typename LeftExprT, typename T, typename FallbackPolicyT,
215 typename make_output_actor<actor<LeftExprT>, attribute_actor<TagT> >::type
216 operator<<(actor<LeftExprT> left,
217 attribute_actor<T, FallbackPolicyT, TagT> right)
219 make_output_actor<actor<LeftExprT>, attribute_actor<T> >::make (left, right);
223 namespace logging = boost::log;
224 namespace expr = logging;
228 template <typename> struct default_formatting
232 struct default_formatting_invoker
237 default_formatting<int> t;
241 boost::auto_test_unit_registrar default_formatting_registrar56 (
242 boost::template_test_case_gen<default_formatting_invoker> (0, 0, 0));
243 template <typename CharT>
245 default_formatting<CharT>::test_method ()
247 expr::stream << expr::attr<my_class> (0);
248 expr::stream << expr::attr<int> (0) << expr::attr<int> (0)
249 << expr::attr<int> (0);