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++/47475] New: Static member function template of class variadic template can't be called from the inside


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47475

           Summary: Static member function template of class variadic
                    template can't be called from the inside
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: flo.goujeon@orange.fr


GCC 4.5 and 4.6 can't compile the following piece of code, which seems valid:
****************************************
template<typename... Ts>
struct test;

template<>
struct test<>
{
    template<typename>
    static void f()
    {
    }
};

template<typename T, typename... Ts>
struct test<T, Ts...>
{
    template<typename U>
    static void f()
    {
        test<Ts...>::f<U>(); //compiler error here
    }
};
****************************************

Here is the compiler error message:
****************************************
|| /usr/local/bin/g++ -c main.cpp -W -Wall -pedantic -std=c++0x
|| main.cpp: In static member function âstatic void test<T, Ts ...>::f()â:
main.cpp|19 col 19| error: expected primary-expression before â>â token
main.cpp|19 col 21| error: expected primary-expression before â)â token
|| make: *** [main.o] Error 1
****************************************

However, GCC doesn't complain with this:
****************************************
int main()
{
    test<int, double>::f<int>();
}
****************************************


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