[llvm-bugs] [Bug 47514] New: Incorrect type lookup in ctor for derived template class

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Sep 14 00:29:04 PDT 2020


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

            Bug ID: 47514
           Summary: Incorrect type lookup in ctor for derived template
                    class
           Product: clang
           Version: 10.0
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: j.thali at gmx.at
                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

clang seems to only search for a qualified name in the class itself in the
example below.

struct SomeStruct { int value; };

template<typename T> class Base{};
template<typename T>
class Derived : public Base<T>
{
public:
  Derived() { int kSize = sizeof(SomeStruct::value); }
};

int main()
{
  Derived<int> x;
  return 0;
}

main.cpp:8:48: error: 'SomeStruct::value' is not a member of class
'Derived<int>'

Note that this works correctly if sizeof is used in a function or the base
class is not a templated class.

-- 
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/20200914/4fb51704/attachment.html>


More information about the llvm-bugs mailing list