Skip to content

non-dependent name treated as if it were dependent, requiring use of template keyword #37647

Closed
@llvmbot

Description

@llvmbot
Bugzilla Link 38299
Resolution DUPLICATE
Resolved on Aug 16, 2018 07:52
Version trunk
OS Linux
Reporter LLVM Bugzilla Contributor
CC @dwblaikie,@DougGregor,@zygoloid,@steveire

Extended Description

This example fails to compile on the marked line, but nothing here is dependent.

struct X {
template
void foo();
};

struct Base {
X get();
};

template
struct Derived : Base
{
void foo() {
auto result = Base::get();
result.foo(); // (*)
}
};

template struct Derived;

The error message is:

error: use 'template' keyword to treat 'foo' as a dependent template name
result.foo(); // (*)
^
template
1 error generated.

BTW, g++ accepts the code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillac++duplicateResolved as duplicate

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions