<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On 13 October 2014 03:53, Richard Smith <span dir="ltr"><<a href="mailto:richard@metafoo.co.uk" target="_blank">richard@metafoo.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span class="">On Sun, Oct 12, 2014 at 3:29 AM, Pavel Morozkin <span dir="ltr"><<a href="mailto:pavel.morozkin@gmail.com" target="_blank">pavel.morozkin@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div>Hello cfe-dev group,</div><div><br></div><div>Consider this template metaprogram:</div><div>template <unsigned N> struct fib { enum { value = fib<N-1>::value + fib<N-2>::value}; };<br></div>template <> struct fib<1> { enum { value = 1 }; };<br>template <> struct fib<0> { enum { value = 0 }; };<div><br></div><div>During compilation of 'fib<2>::value' (after finally getting memoized result of instantiation of struct fib<0>) Clang «instantiates the anonymous enum inside fib<0> and fib<1>» 129 times in sum.</div></div></blockquote><div><br></div></span><div>That sounds like a bug. How are you observing it?</div></div></div></div></blockquote><div><br></div><div>I debugged the metaprogram with use of Metashell tool.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class=""><div dir="ltr"><div>In case, when we use 'constexpr static auto' instead of 'enum', no additional instantiations occurs. Why Clang performs additional instantiations in the first case?</div><div><br></div><div>Thank you,</div><div>Pavel</div></div>
<br></span>_______________________________________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@cs.uiuc.edu" target="_blank">cfe-dev@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div>