https://bugs.llvm.org/show_bug.cgi?id=50496

            Bug ID: 50496
           Summary: Use of auto template parameters breaks partial
                    specialization
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++17
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected], [email protected],
                    [email protected], [email protected]

The following code fails to compile, but should:

  inline constexpr struct S {} C {};

  template <class S>
  struct traits;

  template <auto& A>
  struct odd {};

  template <auto& A>
  struct traits<odd<A>> {};

  int main() {
    traits<odd<C>> t; // ERROR HERE
  }


The commented line in main generated the following error:

  error: implicit instantiation of undefined template 'traits<odd<C>>'
      traits<odd<C>> t;
                     ^

The partial specialization with the auto template parameter fails to match the
instantiation.

GCC accepts the code. A slight tweak causes clang to accept the code (replacing
`auto&` with `const auto&`.

https://godbolt.org/z/M7Y9nvva3

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to