[llvm-bugs] [Bug 44615] New: -fconcepts-ts causes incorrect name lookup for non-type template parameter

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Jan 22 00:06:27 PST 2020


            Bug ID: 44615
           Summary: -fconcepts-ts causes incorrect name lookup for
                    non-type template parameter
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++2a
          Assignee: unassignedclangbugs at nondot.org
          Reporter: david at doublewise.net
                CC: blitzrakete at gmail.com, erik.pilkington at gmail.com,
                    llvm-bugs at lists.llvm.org, richard-llvm at metafoo.co.uk

The following code

namespace s {
        using t = int;

void f();

when compiled with

`clang++ -Xclang -fconcepts-ts -std=c++2a -c main.cpp`

at revision bb9b964

does not actually look up `t` in `s`. Instead, it looks it up in the global
scope, and thus it gives an error of

main.cpp:6:13: error: unknown type name 't'; did you mean 's::t'?
main.cpp:2:8: note: 's::t' declared here
        using t = int;
1 error generated.

If I define a `t` in the global scope as well, it picks up that name and
compiles, using that variable instead. This is demonstrated by the following

#include <type_traits>

namespace s {
        using t = int;

using t = short;

template<s::t x>
void f() {
        static_assert(std::is_same_v<decltype(x), int>);

void g() {

This behavior occurs only if `-Xclang -fconcepts-ts` is passed, but it seems
that this flag is necessary to actually get all of the concepts implementation.

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/20200122/d342a16e/attachment.html>

More information about the llvm-bugs mailing list