Commit c1d3b5d6 authored by Hans Wennborg's avatar Hans Wennborg
Browse files

Merging r321779:

------------------------------------------------------------------------
r321779 | rsmith | 2018-01-03 17:24:17 -0800 (Wed, 03 Jan 2018) | 7 lines

PR35045: Convert injected-class-name to its corresponding simple-template-id
during template argument deduction.

We already did this when the injected-class-name was in P, but missed the case
where it was in A. This (probably) can't happen except in implicit deduction
guides.

------------------------------------------------------------------------

llvm-svn: 322677
parent 122b42e1
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -502,6 +502,10 @@ DeduceTemplateArguments(Sema &S,
                        SmallVectorImpl<DeducedTemplateArgument> &Deduced) {
  assert(Arg.isCanonical() && "Argument type must be canonical");

  // Treat an injected-class-name as its underlying template-id.
  if (auto *Injected = dyn_cast<InjectedClassNameType>(Arg))
    Arg = Injected->getInjectedSpecializationType();

  // Check whether the template argument is a dependent template-id.
  if (const TemplateSpecializationType *SpecArg
        = dyn_cast<TemplateSpecializationType>(Arg)) {
+11 −0
Original line number Diff line number Diff line
@@ -309,6 +309,17 @@ namespace dependent {
  template int New(int);
}

namespace injected_class_name {
  template<typename T = void> struct A {
    A();
    template<typename U> A(A<U>);
  };
  A<int> a;
  A b = a;
  using T = decltype(a);
  using T = decltype(b);
}

#else

// expected-no-diagnostics