[llvm-bugs] [Bug 50170] New: clang fails to compile call to instance of function-typed variable template

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Apr 29 05:18:34 PDT 2021


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

            Bug ID: 50170
           Summary: clang fails to compile call to instance of
                    function-typed variable template
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++17
          Assignee: unassignedclangbugs at nondot.org
          Reporter: simon.giesecke at gmail.com
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

clang version 9 to 12 fail to compile the following code:
```
template <typename T, bool A>
void funcTemplate() {}

template <typename T>
struct Traits {
  template <bool A>
  static inline constexpr auto func =
      funcTemplate<T, A>;
};

template<typename T>
void use() {
  const auto func = Traits<T>::template func<false>;
  func();
}

int main() {
    use<int>();
}
```
with the following diagnostics:
```
<source>:15:3: error: called object type 'auto' is not a function or function
pointer
  func();
  ^~~~
<source>:19:5: note: in instantiation of function template specialization
'use<int>' requested here
    use<int>();
```


clang 8 and recent gcc versions compile this correctly.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20210429/c3b2a82f/attachment.html>


More information about the llvm-bugs mailing list