<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On 9 January 2017 at 14:59, Adam Burr via cfe-dev <span dir="ltr"><<a href="mailto:cfe-dev@lists.llvm.org" target="_blank">cfe-dev@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div style="font-family:'courier new',courier,monaco,monospace,sans-serif;font-size:10pt;color:rgb(0,0,0)"><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px">This compiles in clang 3.8 but I believe it should not:</span></font></div><font face="courier new, courier, monaco, monospace, sans-serif"><div style="font-size:13.3333px"><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><br></span></font></div></font><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>template< class T = int ></div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>struct A</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>{</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div><span class="gmail-m_4443350315809170299Apple-tab-span" style="white-space:pre-wrap"> </span>struct B {};</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div><br></div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div><span class="gmail-m_4443350315809170299Apple-tab-span" style="white-space:pre-wrap"> </span>const B* test (const B* b) const;</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>};</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div><br></div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>template< class T ></div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>inline auto A< T >::test (const B* const b) const -> const B*</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>{</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div><span class="gmail-m_4443350315809170299Apple-tab-span" style="white-space:pre-wrap"> </span>return ++b;</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>}</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div><br></div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>int main()</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>{</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div> A<> m;</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div> const A<>::B* b = 0;</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div> b = m.test (b);</div></span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div><span style="font-size:13.3333px"><div>}</div></span></div></font></blockquote><font face="courier new, courier, monaco, monospace, sans-serif"><div style="font-size:13.3333px"><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><br></span></font></div><div style="font-size:13.3333px"><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px">Here is the same code in </span></font><span style="font-size:13.3333px">coliru:</span></div></font><font face="courier new, courier, monaco, monospace, sans-serif"><div style="font-size:13.3333px"><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><br></span></font></div><span style="font-size:13.3333px"><a href="http://coliru.stacked-crooked.com/a/55a3a6e7d28e8a5d" target="_blank">http://coliru.stacked-crooked.<wbr>com/a/55a3a6e7d28e8a5d</a></span><br></font><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><br></span></font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px">gcc reports the error I was expecting:</span></font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><br></span></font></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><div>main.cpp: In instantiation of 'const A<T>::B* A<T>::test(const A<T>::B*) const [with T = int]':</div></span></font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><div>main.cpp:19:18: required from here</div></span></font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><div>main.cpp:12:9: error: increment of read-only parameter 'b'</div></span></font></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><div> return ++b;</div></span></font></div></blockquote><div><br></div><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><div>This is a very non-critical bug<span style="font-size:13.3333px"> (</span><span style="font-size:13.3333px">if it even is a bug) and</span><span style="font-size:13.3333px"> I do not need a fix but I thought I would point it out because I happened to notice.</span></div></span></font></div></div></div></blockquote><div><br></div><div>Thanks for reporting this issue!</div><div><br></div><div>I've created a bugzilla entry at <a href="https://llvm.org/bugs/show_bug.cgi?id=31607">https://llvm.org/bugs/show_bug.cgi?id=31607</a> since I didn't find any duplicates.</div><div> </div><div>Alex</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;border-left-color:rgb(204,204,204);padding-left:1ex"><div><div style="font-family:'courier new',courier,monaco,monospace,sans-serif;font-size:10pt;color:rgb(0,0,0)"><div><font face="courier new, courier, monaco, monospace, sans-serif"><span style="font-size:13.3333px"><div><br></div><div>Thanks,</div><div>Adam Burr</div><div>Blue Sky Studios</div></span></font></div></div></div><br>______________________________<wbr>_________________<br>
cfe-dev mailing list<br>
<a href="mailto:cfe-dev@lists.llvm.org">cfe-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/cfe-dev</a><br>
<br></blockquote></div><br></div></div>