<div dir="ltr">Richard,<div><br></div><div>Clang crashes for me on this code while doing "check-all". This change seems to introduce the assert. Can you take a look?</div><div><br></div><div>BTW I'm not sure why bots are green. Do we build libcxx with bootstrap compiler?</div><div><br></div><div><br></div><div><div>FAIL: libc++ :: std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp (34988 of 39764)</div><div>******************** TEST 'libc++ :: std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp' FAILED ********************</div><div>Command: ['/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang++', '-o', '/usr/local/google/home/aizatsky/out/llvm/default/projects/libcxx/test/std/experimental/string.view/string.view.find/Output/find</div><div>_last_of_pointer_size_size.pass.cpp.o', '-x', 'c++', '/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp', '-c', </div><div>'-v', '-Werror=thread-safety', '-std=c++1z', '-include', '/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/nasty_macros.hpp', '-nostdinc++', '-I/usr/local/google/home/aizatsky/src/llvm/proj</div><div>ects/libcxx/include', '-D__STDC_FORMAT_MACROS', '-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-I/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support', '-DLIBCXX_FILESYSTEM_STATIC_TEST_R</div><div>OOT="/usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT="/usr/local/google/home/aizatsky/out/llvm/default/</div><div>projects/libcxx/test/filesystem/Output/dynamic_env"', '-DLIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER="/usr/bin/python2.7 /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/filesystem_dynamic_test_h</div><div>elper.py"', '-D_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER', '-Wall', '-Wextra', '-Werror', '-Wshadow', '-Wshadow', '-Wno-unused-command-line-argument', '-Wno-attributes', '-Wno-pessimizing-move', '-Wno-c++11-extension</div><div>s', '-Wno-user-defined-literals', '-Wno-sign-compare', '-Wno-unused-variable', '-Wno-unused-parameter', '-Wno-unused-local-typedef', '-c']</div><div>Exit Code: 254</div><div>Standard Error:</div><div>--</div><div>clang version 4.0.0 (trunk 290130) (llvm/trunk 290127)</div><div>Target: x86_64-unknown-linux-gnu</div><div>Thread model: posix</div><div>InstalledDir: /usr/local/google/home/aizatsky/out/llvm/bootstrap/bin</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.8.4</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9</div><div>Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9</div><div>Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3</div><div>Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8</div><div>Candidate multilib: .;@m64</div><div>Candidate multilib: 32;@m32</div><div>Candidate multilib: x32;@mx32</div><div>Selected multilib: .;@m64</div><div> "/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8" -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name find_last_of_pointer_size_size.pass.cpp -mrelocation</div><div>-model static -mthread-model posix -mdisable-fp-elim -fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64 -v -dwarf-column-info -debugger-tuning=gdb -coverage-not</div><div>es-file /usr/local/google/home/aizatsky/out/llvm/default/projects/libcxx/test/std/experimental/string.view/string.view.find/Output/find_last_of_pointer_size_size.pass.cpp.gcno -nostdinc++ -resource-dir /usr/loc</div><div>al/google/home/aizatsky/out/llvm/bootstrap/bin/../lib/clang/4.0.0 -include /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/nasty_macros.hpp -I /usr/local/google/home/aizatsky/src/llvm/proj</div><div>ects/libcxx/include -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -D __STDC_CONSTANT_MACROS -I /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support -D "LIBCXX_FILESYSTEM_STATIC_TEST_ROOT=\"/us</div><div>r/local/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/filesystem/Inputs/static_test_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_ROOT=\"/usr/local/google/home/aizatsky/out/llvm/default/projec</div><div>ts/libcxx/test/filesystem/Output/dynamic_env\"" -D "LIBCXX_FILESYSTEM_DYNAMIC_TEST_HELPER=\"/usr/bin/python2.7 /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support/filesystem_dynamic_test_helpe</div><div>r.py\"" -D _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER -internal-isystem /usr/local/include -internal-isystem /usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/../lib/clang/4.0.0/include -internal-externc-isystem </div><div>/usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -Werror=thread-safety -Wall -Wextra -Werror -Wshadow -Wshadow -Wno-unused-command-line-argument -Wno-attri</div><div>butes -Wno-pessimizing-move -Wno-c++11-extensions -Wno-user-defined-literals -Wno-sign-compare -Wno-unused-variable -Wno-unused-parameter -Wno-unused-local-typedef -std=c++1z -fdeprecated-macro -fdebug-compilat</div><div>ion-dir /usr/local/google/home/aizatsky/out/llvm/default/projects/libcxx/test/std/experimental/string.view/string.view.find -ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions -fexceptions -</div><div>fdiagnostics-show-option -o /usr/local/google/home/aizatsky/out/llvm/default/projects/libcxx/test/std/experimental/string.view/string.view.find/Output/find_last_of_pointer_size_size.pass.cpp.o -x c++ /usr/local</div><div>/google/home/aizatsky/src/llvm/projects/libcxx/test/std/experimental/string.view/string.view.find/find_last_of_pointer_size_size.pass.cpp</div><div>clang -cc1 version 4.0.0 based upon LLVM 4.0.0svn default target x86_64-unknown-linux-gnu</div></div><div><div>ignoring nonexistent directory "/include"</div><div>#include "..." search starts here:</div><div>#include <...> search starts here:</div><div> /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/include</div><div> /usr/local/google/home/aizatsky/src/llvm/projects/libcxx/test/support</div><div> /usr/local/include</div><div> /usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/../lib/clang/4.0.0/include</div><div> /usr/include/x86_64-linux-gnu</div><div> /usr/include</div><div>End of search list.</div><div>clang-3.8: /usr/local/google/home/aizatsky/src/llvm/include/llvm/Support/Casting.h:229: typename llvm::cast_retty<To, From>::ret_type llvm::cast(Y&) [with X = clang::FunctionProtoType; Y = clang::QualType; type</div><div>name llvm::cast_retty<To, From>::ret_type = const clang::FunctionProtoType*]: Assertion `isa<X>(Val) && "cast<Ty>() argument of incompatible type!"' failed.</div><div>#0 0x0000000001d69335 llvm::sys::PrintStackTrace(llvm::raw_ostream&) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x1d69335)</div><div>#1 0x0000000001d6734e llvm::sys::RunSignalHandlers() (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x1d6734e)</div><div>#2 0x0000000001d674b2 SignalHandler(int) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x1d674b2)</div><div>#3 0x00007faad044a330 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)</div><div>#4 0x00007faacf245c37 gsignal /build/eglibc-oGUzwX/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0</div><div>#5 0x00007faacf249028 abort /build/eglibc-oGUzwX/eglibc-2.19/stdlib/abort.c:91:0</div><div>#6 0x00007faacf23ebf6 __assert_fail_base /build/eglibc-oGUzwX/eglibc-2.19/assert/assert.c:92:0</div><div>#7 0x00007faacf23eca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)</div><div>#8 0x00000000032bfb1c (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x32bfb1c)</div><div>#9 0x00000000032bfc3d clang::ASTContext::hasSameFunctionTypeIgnoringExceptionSpec(clang::QualType, clang::QualType) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x32bfc3d)</div><div>#10 0x0000000002baaee1 clang::Sema::CheckFunctionDeclaration(clang::Scope*, clang::FunctionDecl*, clang::LookupResult&, bool) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x2baaee1)</div><div>#11 0x0000000002baf81e clang::Sema::ActOnFunctionDeclarator(clang::Scope*, clang::Declarator&, clang::DeclContext*, clang::TypeSourceInfo*, clang::LookupResult&, llvm::MutableArrayRef<clang::TemplateParameterLi</div><div>st*>, bool&) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x2baf81e)</div><div>#12 0x0000000002bb5c2d clang::Sema::HandleDeclarator(clang::Scope*, clang::Declarator&, llvm::MutableArrayRef<clang::TemplateParameterList*>) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x</div><div>2bb5c2d)</div><div>#13 0x0000000002bb61f9 clang::Sema::ActOnDeclarator(clang::Scope*, clang::Declarator&) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x2bb61f9)</div><div>#14 0x0000000002909884 clang::Parser::ParseDeclarationAfterDeclaratorAndAttributes(clang::Declarator&, clang::Parser::ParsedTemplateInfo const&, clang::Parser::ForRangeInit*) (/usr/local/google/home/aizatsky/ou</div><div>t/llvm/bootstrap/bin/clang-3.8+0x2909884)</div><div>#15 0x0000000002918779 clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&, unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.</div><div>8+0x2918779)</div><div>#16 0x00000000028f84b2 clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/local/google/home/aizatsky/out/llvm/bootstr</div><div>ap/bin/clang-3.8+0x28f84b2)</div><div>#17 0x00000000028f8bae clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/local/google/home/aizatsky/out/llvm/b</div><div>ootstrap/bin/clang-3.8+0x28f8bae)</div><div>#18 0x00000000028fc84f clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x28fc84f)</div><div>#19 0x000000000292f8ff clang::Parser::ParseLinkage(clang::ParsingDeclSpec&, unsigned int) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x292f8ff)</div><div>#20 0x00000000028f85cd clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec&, clang::AccessSpecifier) (/usr/local/google/home/aizatsky/out/llvm/bootstr</div><div>ap/bin/clang-3.8+0x28f85cd)</div><div>#21 0x00000000028f8bae clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*, clang::AccessSpecifier) (/usr/local/google/home/aizatsky/out/llvm/b</div><div>ootstrap/bin/clang-3.8+0x28f8bae)</div><div>#22 0x00000000028fc84f clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&, clang::ParsingDeclSpec*) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x28fc84f)</div><div>#23 0x00000000028fd392 clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x28fd392)</div><div>#24 0x00000000028f5acb clang::ParseAST(clang::Sema&, bool, bool) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x28f5acb)</div><div>#25 0x000000000250587e clang::CodeGenAction::ExecuteAction() (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x250587e)</div><div>#26 0x00000000022104d6 clang::FrontendAction::Execute() (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x22104d6)</div><div>#27 0x00000000021ea4b6 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x21ea4b6)</div><div>#28 0x0000000002298efa clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0x2298efa)</div><div>#29 0x0000000000ad1c38 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0xad1c38)</div><div>#30 0x0000000000a72391 main (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0xa72391)</div><div>#31 0x00007faacf230f45 __libc_start_main /build/eglibc-oGUzwX/eglibc-2.19/csu/libc-start.c:321:0</div><div>#32 0x0000000000acdcfe _start (/usr/local/google/home/aizatsky/out/llvm/bootstrap/bin/clang-3.8+0xacdcfe)</div></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, Dec 14, 2016 at 6:46 PM Richard Smith via cfe-commits <<a href="mailto:cfe-commits@lists.llvm.org">cfe-commits@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: rsmith<br class="gmail_msg">
Date: Wed Dec 14 20:35:39 2016<br class="gmail_msg">
New Revision: 289754<br class="gmail_msg">
<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=289754&view=rev" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project?rev=289754&view=rev</a><br class="gmail_msg">
Log:<br class="gmail_msg">
[c++1z] Permit constant evaluation of a call through a function pointer whose<br class="gmail_msg">
type differs from the type of the actual function due to having a different<br class="gmail_msg">
exception specification.<br class="gmail_msg">
<br class="gmail_msg">
Modified:<br class="gmail_msg">
    cfe/trunk/include/clang/AST/ASTContext.h<br class="gmail_msg">
    cfe/trunk/lib/AST/ASTContext.cpp<br class="gmail_msg">
    cfe/trunk/lib/AST/ExprConstant.cpp<br class="gmail_msg">
    cfe/trunk/lib/Sema/SemaDecl.cpp<br class="gmail_msg">
    cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/include/clang/AST/ASTContext.h<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=289754&r1=289753&r2=289754&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ASTContext.h?rev=289754&r1=289753&r2=289754&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/include/clang/AST/ASTContext.h (original)<br class="gmail_msg">
+++ cfe/trunk/include/clang/AST/ASTContext.h Wed Dec 14 20:35:39 2016<br class="gmail_msg">
@@ -1109,6 +1109,10 @@ public:<br class="gmail_msg">
   /// \brief Change the result type of a function type once it is deduced.<br class="gmail_msg">
   void adjustDeducedFunctionResultType(FunctionDecl *FD, QualType ResultType);<br class="gmail_msg">
<br class="gmail_msg">
+  /// \brief Determine whether two function types are the same, ignoring<br class="gmail_msg">
+  /// exception specifications in cases where they're part of the type.<br class="gmail_msg">
+  bool hasSameFunctionTypeIgnoringExceptionSpec(QualType T, QualType U);<br class="gmail_msg">
+<br class="gmail_msg">
   /// \brief Change the exception specification on a function once it is<br class="gmail_msg">
   /// delay-parsed, instantiated, or computed.<br class="gmail_msg">
   void adjustExceptionSpec(FunctionDecl *FD,<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/lib/AST/ASTContext.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=289754&r1=289753&r2=289754&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=289754&r1=289753&r2=289754&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/lib/AST/ASTContext.cpp (original)<br class="gmail_msg">
+++ cfe/trunk/lib/AST/ASTContext.cpp Wed Dec 14 20:35:39 2016<br class="gmail_msg">
@@ -2382,6 +2382,14 @@ static QualType getFunctionTypeWithExcep<br class="gmail_msg">
       Proto->getExtProtoInfo().withExceptionSpec(ESI));<br class="gmail_msg">
 }<br class="gmail_msg">
<br class="gmail_msg">
+bool ASTContext::hasSameFunctionTypeIgnoringExceptionSpec(QualType T,<br class="gmail_msg">
+                                                          QualType U) {<br class="gmail_msg">
+  return hasSameType(T, U) ||<br class="gmail_msg">
+         (getLangOpts().CPlusPlus1z &&<br class="gmail_msg">
+          hasSameType(getFunctionTypeWithExceptionSpec(*this, T, EST_None),<br class="gmail_msg">
+                      getFunctionTypeWithExceptionSpec(*this, U, EST_None)));<br class="gmail_msg">
+}<br class="gmail_msg">
+<br class="gmail_msg">
 void ASTContext::adjustExceptionSpec(<br class="gmail_msg">
     FunctionDecl *FD, const FunctionProtoType::ExceptionSpecInfo &ESI,<br class="gmail_msg">
     bool AsWritten) {<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/lib/AST/ExprConstant.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=289754&r1=289753&r2=289754&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ExprConstant.cpp?rev=289754&r1=289753&r2=289754&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/lib/AST/ExprConstant.cpp (original)<br class="gmail_msg">
+++ cfe/trunk/lib/AST/ExprConstant.cpp Wed Dec 14 20:35:39 2016<br class="gmail_msg">
@@ -4434,8 +4434,11 @@ public:<br class="gmail_msg">
       }<br class="gmail_msg">
<br class="gmail_msg">
       // Don't call function pointers which have been cast to some other type.<br class="gmail_msg">
-      if (!Info.Ctx.hasSameType(CalleeType->getPointeeType(), FD->getType()))<br class="gmail_msg">
+      // Per DR (no number yet), the caller and callee can differ in noexcept.<br class="gmail_msg">
+      if (!Info.Ctx.hasSameFunctionTypeIgnoringExceptionSpec(<br class="gmail_msg">
+              CalleeType->getPointeeType(), FD->getType())) {<br class="gmail_msg">
         return Error(E);<br class="gmail_msg">
+      }<br class="gmail_msg">
     } else<br class="gmail_msg">
       return Error(E);<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=289754&r1=289753&r2=289754&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=289754&r1=289753&r2=289754&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)<br class="gmail_msg">
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Wed Dec 14 20:35:39 2016<br class="gmail_msg">
@@ -9076,27 +9076,16 @@ bool Sema::CheckFunctionDeclaration(Scop<br class="gmail_msg">
       ASTContext::GetBuiltinTypeError Error;<br class="gmail_msg">
       LookupPredefedObjCSuperType(*this, S, NewFD->getIdentifier());<br class="gmail_msg">
       QualType T = Context.GetBuiltinType(BuiltinID, Error);<br class="gmail_msg">
-      if (!T.isNull() && !Context.hasSameType(T, NewFD->getType())) {<br class="gmail_msg">
-        auto WithoutExceptionSpec = [&](QualType T) -> QualType {<br class="gmail_msg">
-          auto *Proto = T->getAs<FunctionProtoType>();<br class="gmail_msg">
-          if (!Proto)<br class="gmail_msg">
-            return T;<br class="gmail_msg">
-          return Context.getFunctionType(<br class="gmail_msg">
-              Proto->getReturnType(), Proto->getParamTypes(),<br class="gmail_msg">
-              Proto->getExtProtoInfo().withExceptionSpec(EST_None));<br class="gmail_msg">
-        };<br class="gmail_msg">
-<br class="gmail_msg">
-        // If the type of the builtin differs only in its exception<br class="gmail_msg">
-        // specification, that's OK.<br class="gmail_msg">
-        // FIXME: If the types do differ in this way, it would be better to<br class="gmail_msg">
-        // retain the 'noexcept' form of the type.<br class="gmail_msg">
-        if (!getLangOpts().CPlusPlus1z ||<br class="gmail_msg">
-            !Context.hasSameType(WithoutExceptionSpec(T),<br class="gmail_msg">
-                                 WithoutExceptionSpec(NewFD->getType())))<br class="gmail_msg">
-          // The type of this function differs from the type of the builtin,<br class="gmail_msg">
-          // so forget about the builtin entirely.<br class="gmail_msg">
-          Context.BuiltinInfo.forgetBuiltin(BuiltinID, Context.Idents);<br class="gmail_msg">
-      }<br class="gmail_msg">
+      // If the type of the builtin differs only in its exception<br class="gmail_msg">
+      // specification, that's OK.<br class="gmail_msg">
+      // FIXME: If the types do differ in this way, it would be better to<br class="gmail_msg">
+      // retain the 'noexcept' form of the type.<br class="gmail_msg">
+      if (!T.isNull() &&<br class="gmail_msg">
+          !Context.hasSameFunctionTypeIgnoringExceptionSpec(T,<br class="gmail_msg">
+                                                            NewFD->getType()))<br class="gmail_msg">
+        // The type of this function differs from the type of the builtin,<br class="gmail_msg">
+        // so forget about the builtin entirely.<br class="gmail_msg">
+        Context.BuiltinInfo.forgetBuiltin(BuiltinID, Context.Idents);<br class="gmail_msg">
     }<br class="gmail_msg">
<br class="gmail_msg">
     // If this function is declared as being extern "C", then check to see if<br class="gmail_msg">
<br class="gmail_msg">
Modified: cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp<br class="gmail_msg">
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp?rev=289754&r1=289753&r2=289754&view=diff" rel="noreferrer" class="gmail_msg" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp?rev=289754&r1=289753&r2=289754&view=diff</a><br class="gmail_msg">
==============================================================================<br class="gmail_msg">
--- cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp (original)<br class="gmail_msg">
+++ cfe/trunk/test/SemaCXX/constant-expression-cxx1z.cpp Wed Dec 14 20:35:39 2016<br class="gmail_msg">
@@ -28,7 +28,9 @@ namespace BaseClassAggregateInit {<br class="gmail_msg">
<br class="gmail_msg">
 namespace NoexceptFunctionTypes {<br class="gmail_msg">
   template<typename T> constexpr bool f() noexcept(true) { return true; }<br class="gmail_msg">
+  constexpr bool (*fp)() = f<int>;<br class="gmail_msg">
   static_assert(f<int>());<br class="gmail_msg">
+  static_assert(fp());<br class="gmail_msg">
<br class="gmail_msg">
   template<typename T> struct A {<br class="gmail_msg">
     constexpr bool f() noexcept(true) { return true; }<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
_______________________________________________<br class="gmail_msg">
cfe-commits mailing list<br class="gmail_msg">
<a href="mailto:cfe-commits@lists.llvm.org" class="gmail_msg" target="_blank">cfe-commits@lists.llvm.org</a><br class="gmail_msg">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits" rel="noreferrer" class="gmail_msg" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits</a><br class="gmail_msg">
</blockquote></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr">Mike<br>Sent from phone</div></div>