1 // RUN: %clang_cc1 -fsyntax-only -verify -Wundefined-func-template %s
4 template <typename T
> class B
{
6 constexpr void foo(const T
&) { bar(1); }
7 virtual constexpr void bar(unsigned int) = 0;
10 template <typename T
> class D
: public B
<T
> {
12 constexpr void bar(unsigned int) override
{}
21 namespace call_pure_virtual_function_from_virtual
{
22 template <typename T
> class B
{
24 const void foo(const T
&) { B::bar(1); } // expected-warning {{instantiation of function 'call_pure_virtual_function_from_virtual::B<int>::bar' required here, but no definition is available}}
25 // expected-note@-1 {{add an explicit instantiation declaration to suppress this warning if 'call_pure_virtual_function_from_virtual::B<int>::bar' is explicitly instantiated in another translation unit}}
26 virtual const void bar(unsigned int) = 0; // expected-note {{forward declaration of template entity is here}}
29 template <typename T
> class D
: public B
<T
> {
31 const void bar(unsigned int) override
{}
36 t
.foo(0); // expected-note {{in instantiation of member function 'call_pure_virtual_function_from_virtual::B<int>::foo' requested here}}
40 namespace non_pure_virtual_function
{
41 template <typename T
> class B
{
43 constexpr void foo(const T
&) { bar(1); }
45 virtual constexpr void bar(unsigned int); // expected-warning {{inline function 'non_pure_virtual_function::B<int>::bar' is not defined}}
46 // expected-note@-1 {{forward declaration of template entity is here}}
47 // expected-note@-2 {{forward declaration of template entity is here}}
48 // expected-note@-3 {{forward declaration of template entity is here}}
51 template <typename T
> class D
: public B
<T
> { // expected-warning {{instantiation of function 'non_pure_virtual_function::B<int>::bar' required here, but no definition is available}}
52 // expected-warning@-1 {{instantiation of function 'non_pure_virtual_function::B<int>::bar' required here, but no definition is available}}
53 // expected-warning@-2 {{instantiation of function 'non_pure_virtual_function::B<int>::bar' required here, but no definition is available}}
54 // expected-note@-3 {{add an explicit instantiation declaration to suppress this warning if 'non_pure_virtual_function::B<int>::bar' is explicitly instantiated in another translation unit}}
55 // expected-note@-4 {{add an explicit instantiation declaration to suppress this warning if 'non_pure_virtual_function::B<int>::bar' is explicitly instantiated in another translation unit}}
56 // expected-note@-5 {{add an explicit instantiation declaration to suppress this warning if 'non_pure_virtual_function::B<int>::bar' is explicitly instantiated in another translation unit}}
57 // expected-note@-6 {{used here}}
60 constexpr void bar(unsigned int) override
{ }