[cfe-users] how to stop inlining a recursive template function

Larry Evans cppljevans at suddenlink.net
Tue Dec 30 12:26:40 PST 2014


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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: excessive_recursive_template_instantiation.cpp
Type: text/x-c++src
Size: 3490 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-users/attachments/20141230/53098eb0/attachment.cpp>


More information about the cfe-users mailing list