[PATCH] D29880: Workaround MSVC bug when using TrailingObjects from a template.

James Y Knight via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 13 17:14:38 PST 2017


jyknight added a comment.

I just noticed that the test case I wrote is passing a bogus first-argument to the template -- and so is your modified version in the comment above. So any errors resulting from that are probably not useful to examine. The testcase should've look like this instead:

I'm assuming the error coming from swift is actually from something else?

  // Test the use of TrailingObjects with a template class. This                                                                                                                      
  // previously failed to compile due to a bug in MSVC's member access                                                                                                                
  // control/lookup handling for OverloadToken.                                                                                                                                       
  template <typename Derived>
  class Class5Tmpl : private llvm::TrailingObjects<Derived, float, int> {
    using TrailingObjects = typename llvm::TrailingObjects<Derived, float>;
    friend TrailingObjects;
  
    size_t numTrailingObjects(
        typename TrailingObjects::template OverloadToken<float>) const {
      return 1;
    }
  
    size_t numTrailingObjects(                                                                                                                                                              typename TrailingObjects::template OverloadToken<int>) const {
      return 2;
    }
  };
  
  class Class5 : public Class5Tmpl<Class5> {}




https://reviews.llvm.org/D29880





More information about the llvm-commits mailing list