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

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 5 09:46:50 PST 2018



On 12/4/18 7:07 PM, Richard Smith wrote:
> On Tue, 4 Dec 2018 at 16:46, Erik Pilkington via cfe-commits 
> <cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>> wrote:
>
>     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 <http://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;
>
>
> This is ill-formed due to the redefinition of the template; we should 
> at least have a FIXME to properly reject it.

Ah, good point. Added a FIXME in r348388. The fix for this is 
https://reviews.llvm.org/D21508.

Thanks!

>     +}
>
>
>     _______________________________________________
>     cfe-commits mailing list
>     cfe-commits at lists.llvm.org <mailto:cfe-commits at lists.llvm.org>
>     http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181205/dedeb76c/attachment.html>


More information about the cfe-commits mailing list