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

            Bug ID: 65497
           Summary: Call to member function template named the same as
                    class template is rejected
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: lucdanton at free dot fr

Created attachment 35076
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35076&action=edit
Minimal testcase

$ g++-trunk --version
g++-trunk (GCC) 5.0.0 20150319 (experimental)
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

$ cat main.cpp
template<typename> struct foo {};

template<typename>
struct bar {
    template<typename> void foo() const {}
};

template<typename T>
void qux(bar<T> b)
{ b.template foo<void>(); }

int main()
{
    bar<void> b;
    qux(b);
}
$ g++-trunk -std=c++03 main.cpp
main.cpp: In function 'void qux(bar<T>)':
main.cpp:10:5: error: invalid use of 'struct foo<void>'
 { b.template foo<void>(); }
     ^

-----

I would expect the code to compile as-is (in all C++03/11/1y/1z modes). In any
case, Clang does accept it. At the very least the error message seems bogus.

Reply via email to