r217995 - Instantiate exception specifications when instantiating function types (other

Aaron Ballman aaron at aaronballman.com
Thu Sep 18 06:26:10 PDT 2014


>>>>> ==============================================================================
>>>>> --- cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp (original)
>>>>> +++ cfe/trunk/lib/Sema/SemaTemplateInstantiate.cpp Wed Sep 17 18:57:05
>>>>> 2014
>>>>> @@ -788,12 +788,14 @@ namespace {
>>>>>      /// pack.
>>>>>      ExprResult TransformFunctionParmPackExpr(FunctionParmPackExpr *E);
>>>>>
>>>>> -    QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
>>>>> -                                        FunctionProtoTypeLoc TL);
>>>>> +    // Pull in the base class overload; it just forwards to our
>>>>> function.
>>>>> +    using inherited::TransformFunctionProtoType;

I think that this using declaration is the root cause. It is pulling
in all of the inherited declarations of TransformFunctionProtoType,
but that is causing ambiguity for MSVC -- and it's because of the
template parameter.

Here's a simple way to reproduce:

struct B {
  void f(int) {}
  template <typename Fn>
  void f(double, Fn) {}
};

struct D : B {
  using B::f;
  template <typename Fn>
  void f(double, Fn) {}

  void g() {
    f(1.2, []() {});
  }
};

If you remove the template, MSVC is fine.

>>>>> +    template<typename Fn>
>>>>>      QualType TransformFunctionProtoType(TypeLocBuilder &TLB,
>>>>>                                          FunctionProtoTypeLoc TL,
>>>>>                                          CXXRecordDecl *ThisContext,
>>>>> -                                        unsigned ThisTypeQuals);
>>>>> +                                        unsigned ThisTypeQuals,
>>>>> +                                        Fn TransformExceptionSpec);

~Aaron



More information about the cfe-commits mailing list