<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Apr 6, 2016 at 1:51 AM, Liu Xin 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote">hi, CFE list,</div><div class="gmail_quote"><br><div dir="ltr"><div>I wonder if C++ allows to declare exception spec in typdef.</div></div></div></div></blockquote><div><br></div><div>No current C++ standard allows this. C++17 will (and more generally, exception specifications become a first-class part of the type system in C++17), but this feature is not yet implemented (see <a href="http://clang.llvm.org/cxx_status.html#cxx17">http://clang.llvm.org/cxx_status.html#cxx17</a>).</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><div dir="ltr"><div>eg. </div><div>typedef int name() throw(int) ;<br></div><div><br></div><div>I tested t.cpp using g++/clang, they all forbid this behavior. </div><div><br></div><div>clang gives me quite clear answer. </div><div><div>t.cpp:4:20: error: exception specifications are not allowed in typedefs</div><div>typedef int name() throw(int) ;</div><div>                   ^</div><div>t.cpp:5:24: error: exception specifications are not allowed in typedefs</div><div>typedef int (*pname)() throw(int) ;</div><div>                       ^</div><div>t.cpp:6:24: error: exception specifications are not allowed in typedefs</div><div>typedef int (&rname)() throw(int) ;</div><div>                       ^</div><div>3 errors generated.</div></div><div><br></div><div>t.cpp is actually from microsoft's AMP testsuite. I believe VC++ accepts it (sorry, I didn't verify using vc++, because I can't access windows by now). </div><div><br></div><div>According to my google result, N4533 and P0012R1 try to remove this restriction, am I right?</div><div><a href="http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html" target="_blank">http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/p0012r1.html</a></div></div></div></div></blockquote><div><br></div><div>Correct. They also make 'throw(int)' a deprecated synonym of 'noexcept(false)'. I suspect MSVC just doesn't implement the C++98 rule, rather than already implementing the P0012 rule...</div></div></div></div>