This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/78623] New: non-dependent name treated as if it were dependent, requiring use of template keyword


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78623

            Bug ID: 78623
           Summary: non-dependent name treated as if it were dependent,
                    requiring use of template keyword
           Product: gcc
           Version: 6.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: barry.revzin at gmail dot com
  Target Milestone: ---

This example fails to compile on the marked line - gcc requires me to write
result.template foo<void>(), which shouldn't be necessary. Nothing here is
dependent. 

If I declared result as an X rather than with auto, the code compiles fine.

struct X { 
    template <class T>
    void foo();
};

struct Base {
    X get();
};

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

template struct Derived<int>;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]