Issue 134526
Summary [Clang] Clang fails to deduce the type of variable member templates
Labels clang:frontend, diverges-from:gcc, diverges-from:msvc
Assignees
Reporter zyn0217
    The following code has been rejected since Clang 9, with a suspicious error:

```cpp

template <class T>
struct S {
  template <class U>
 static const auto var = T();

  template <class U>
  static const auto foo = var<T>;
};

const int p = S<int>::var<int> + S<int>::foo<int>;

```

```
invalid operands to binary _expression_ ('const auto' and 'const auto')
   10 | const int p = S<int>::var<int> + S<int>::foo<int>;
      |               ~~~~~~~~~~~~~~~~ ^ ~~~~~~~~~~~~~~~~
```

https://compiler-explorer.com/z/jc1To6c38

The code is accepted by GCC (since 5.1), MSVC but also rejected by EDG.

It's unclear to me if this is conforming per the standard, but from my gut feeling this should be valid
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to