r348325 - [Sema] Remove some conditions of a failing assert

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Tue Dec 4 16:43:11 PST 2018


Author: epilk
Date: Tue Dec  4 16:43:11 2018
New Revision: 348325

URL: http://llvm.org/viewvc/llvm-project?rev=348325&view=rev
Log:
[Sema] Remove some conditions of a failing assert

We should have been checking that this state is consistent, but its
possible for it to be filled later, so it isn't really sound to check
it here anyways.

Fixes llvm.org/PR39742

Modified:
    cfe/trunk/lib/AST/DeclTemplate.cpp
    cfe/trunk/test/SemaCXX/friend-template-redecl.cpp

Modified: cfe/trunk/lib/AST/DeclTemplate.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/DeclTemplate.cpp?rev=348325&r1=348324&r2=348325&view=diff
==============================================================================
--- cfe/trunk/lib/AST/DeclTemplate.cpp (original)
+++ cfe/trunk/lib/AST/DeclTemplate.cpp Tue Dec  4 16:43:11 2018
@@ -329,8 +329,6 @@ void FunctionTemplateDecl::mergePrevDecl
 
   // Ensure we don't leak any important state.
   assert(ThisCommon->Specializations.size() == 0 &&
-         !ThisCommon->InstantiatedFromMember.getPointer() &&
-         !ThisCommon->InstantiatedFromMember.getInt() &&
          "Can't merge incompatible declarations!");
 
   Base::Common = PrevCommon;

Modified: cfe/trunk/test/SemaCXX/friend-template-redecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/friend-template-redecl.cpp?rev=348325&r1=348324&r2=348325&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/friend-template-redecl.cpp (original)
+++ cfe/trunk/test/SemaCXX/friend-template-redecl.cpp Tue Dec  4 16:43:11 2018
@@ -18,3 +18,14 @@ void f() {
   foo(x);
   bar(x);
 }
+
+namespace PR39742 {
+template<typename>
+struct wrapper {
+  template<typename>
+  friend void friend_function_template() {}
+};
+
+wrapper<bool> x;
+wrapper<int> y;
+}




More information about the cfe-commits mailing list