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: unassignedclangb...@nondot.org
          Reporter: stephane.zimmerm...@trust-in-soft.com
                CC: blitzrak...@gmail.com, dgre...@apple.com,
                    erik.pilking...@gmail.com, llvm-bugs@lists.llvm.org,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to