On 12/30/2014 01:03 PM, Larry Evans wrote: > With: > > > http://llvm.org/releases/3.5.0/clang+llvm-3.5.0-x86_64-linux-gnu-ubuntu-14.04.tar.xz > > downloaded on: > > 2014-11-03.2250 > > and with the compile command: > > /dwnlds/llvm/3.5/binary/clang+llvm-3.5.0-x86_64-linux-gnu/bin/clang++ -c > -O0 -g -stdlib=libc++ -std=c++14 -ftemplate-backtrace-limit=0 > -I/home/evansl/prog_dev/boost/sandbox/rw/non_variadic_templates > -I/home/evansl/prog_dev/boost/boost-modular/TBoost.Conversion > -I/home/evansl/prog_dev/boost/boost-modular/enums > -I/home/evansl/prog_dev/clang/libcxx/sandbox/libs/composite_storage/include > -I/home/evansl/prog_dev/boost/sandbox/rw/sandbox/lje > -I/home/evansl/prog_dev/boost/boost-releases/ro/boost_1_56_0 > -DTYPE_AT_IMPL=0 -ftemplate-depth=324 texpressions.cpp -MMD -o > /tmp/build/clangxx3_5_bin/clang/libcxx/sandbox/libs/gram_stk/sandbox/texpressions.o > > > I'm getting the error message: > > In file included from texpressions.cpp:1: > ./texpressions.hpp:1076:36: fatal error: recursive template > instantiation exceeded maximum depth of 324 > boost::trace_scope trace_scope(__FUNCTION__); > ^ > ./texpressions.hpp:991:19: note: in instantiation of function template > specialization [snip] For what it's worth, I did try to simplify the problem, but the simplified code, attached, compiles without any error.
-regards, Larry
//Purpose: // simplify the problem occuring // in texpressions.cpp at commit: /* commit 38fc87a03574c1748518f9c750f79a6cd9715b17 Author: lje <[email protected]> Date: Wed Dec 17 16:18:20 2014 -0600 record the: "recursive template instantiation exceeded maximum depth" problem again and provide a reference for the purpose comment in another .cpp file which will attempt to simplify the problem. */ // //============================ #include <boost/utility/trace_scope.hpp> #include <boost/range/iterator_range.hpp> #include <iostream> template < typename... Ts > struct type_seq {}; struct nil {}; template < unsigned U > struct lit {}; struct op_or ; struct op_and ; struct var { using rhs= type_seq < op_or , type_seq < op_and , type_seq < op_or , lit<1> , lit<2> > , var > , nil > //var = lit<999> & var | nil //i.e. var is a list of 999's. ; }; #include <vector> using iter_range= boost::iterator_range<std::vector<unsigned>::const_iterator> ; std::ostream& operator<< ( std::ostream& os , iter_range ir ) { os<<"{ "; for(unsigned i=0; !ir.empty(); ++i) { if(i) os<<", "; os<<ir.front(); ir.advance_begin(1); } os<<"}"; return os; } template < typename Operand0 , typename Operand1 > bool parse ( iter_range& a_iter , type_seq < op_or , Operand0 , Operand1 >const& ) { boost::trace_scope trace_scope("op_or"); bool result=true; if(parse(a_iter, Operand0{})) { std::cout<<"Operand0\n"; } else if(parse(a_iter, Operand1{})) { std::cout<<"Operand1\n"; } else { result=false; } std::cout<<":result="<<result<<"\n"; return result; } template < typename Operand0 , typename Operand1 > bool parse ( iter_range& a_iter , type_seq < op_and , Operand0 , Operand1 >const& ) { boost::trace_scope trace_scope("op_and"); bool result=false; if(!parse(a_iter, Operand0{})) { std::cout<<"Operand0\n"; } else if(!parse(a_iter, Operand1{})) { std::cout<<"Operand1\n"; } else { result=true; } std::cout<<":result="<<result<<"\n"; return result; } bool parse ( iter_range& a_iter , nil const& ) { bool result=true; std::cout<<"nil:a_iter="<<a_iter<<"\n"; return result; } bool parse ( iter_range& a_iter , var const& ) { boost::trace_scope trace_scope("var"); return parse(a_iter,var::rhs()); } template < unsigned U > bool parse ( iter_range& a_iter , lit<U> const& ) { boost::trace_scope trace_scope("lit"); bool result=false; if(!a_iter.empty()) { unsigned u=a_iter.front(); std::cout<<";U="<<U<<";u="<<u<<"\n"; result=U==u; if(result) { a_iter.advance_begin(1); } } std::cout<<";a_iter="<<a_iter<<";result="<<result<<"\n"; return result; } int main ( ) { boost::iostreams::indent_scoped_ostreambuf<char> indent_outbuf(std::cout,2); std::vector<unsigned> inp{1,2,1,1}; iter_range iter(inp.begin(),inp.end()); var a_var; std::cout<<"before parse:iter="<<iter<<"\n"; parse(iter,a_var); std::cout<<"after parse:iter="<<iter<<"\n"; return 0; }
_______________________________________________ cfe-users mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-users
