[llvm-bugs] [Bug 48140] New: Clang fails to parse "s.name < ..." comparison in function template if variable template "name" is also in scope

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Nov 10 10:35:14 PST 2020


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

            Bug ID: 48140
           Summary: Clang fails to parse "s.name < ..." comparison in
                    function template if variable template "name" is also
                    in scope
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Frontend
          Assignee: unassignedclangbugs at nondot.org
          Reporter: lang.luca at ymail.com
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

```
template<class T> constexpr int idx = 1;

template<class T> bool f(T t) { return t.idx < 0; };
```

produces

```
<source>:3:49: error: expected '>'
template<class T> bool f(T t) { return t.idx < 0; }
                                                ^
<source>:3:46: note: to match this '<'
template<class T> bool f(T t) { return t.idx < 0; }
                                             ^
```

Affects -std=c++{14,17,20} and versions 3.5 -- trunk.

Godbolt: https://godbolt.org/z/oj76Pq

-- 
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/20201110/816f2328/attachment-0001.html>


More information about the llvm-bugs mailing list