Skip to content

clang incorrectly emits -Wundefined-func-template warning #92486

Open
@ahatanak

Description

@ahatanak

$ cat test.cpp

class c {
protected:
  virtual ~c();
  virtual int *d() const;
};

template <typename> class e : c {
  int *d() const override;
};

int t = sizeof(e<int>);

$ clang++ -c -std=gnu++2b -Wundefined-func-template test.cpp

test.cpp:7:27: warning: instantiation of function 'e::d' required here, but no definition is available [-Wundefined-func-template]
7 | template class e : c {

I don’t think instantiation of e::d is needed to compute the size of the class.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:diagnosticsNew/improved warning or error message in Clang, but not in clang-tidy or static analyzerfalse-positiveWarning fires when it should not

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions