[llvm-bugs] [Bug 46341] New: Name resolution issue for inherited member in local class of templated function

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Jun 16 01:25:34 PDT 2020


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

            Bug ID: 46341
           Summary: Name resolution issue for inherited member in local
                    class of templated function
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: stephane.zimmermann at trust-in-soft.com
                CC: blitzrakete at gmail.com, dgregor at apple.com,
                    erik.pilkington at gmail.com, llvm-bugs at lists.llvm.org,
                    richard-llvm at metafoo.co.uk

Created attachment 23618
  --> https://bugs.llvm.org/attachment.cgi?id=23618&action=edit
Test file

With the following test.cpp file:

    template<typename T>
    struct Bar {
        int f;
    };

    template <typename T>
    int foo() {
        struct Baz: Bar<T> {
            int func() { return f; }
        };
        return 0;
    }

    int
    main()
    {
        foo<int>();
    }

The command `clang++ test.cpp` yields:
> test.cpp:11:29: error: use of undeclared identifier 'f'
>        int func() { return f; }

This seems to be incorrect, since `f` in this case is declared as a field of
`Bar<int>` and should be found during the member name lookup.

This can be seen and tested in compiler explorer here:
https://godbolt.org/z/frfoDA

-- 
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/20200616/87d61962/attachment-0001.html>


More information about the llvm-bugs mailing list