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



             Bug #: 55558

           Summary: [C++11] decltype on a static member variable of a

                    specialized class in a template function results in an

                    internal compiler error

    Classification: Unclassified

           Product: gcc

           Version: 4.7.2

            Status: UNCONFIRMED

          Severity: major

          Priority: P3

         Component: c++

        AssignedTo: unassig...@gcc.gnu.org

        ReportedBy: dev...@gmx.net





The following piece of code:



template<class T> class A

{

};



class B

{

};



template<> class A<B>

{

public:

    static int member;

};



template<typename T> void foobar ()

{

    typedef decltype (A<B>::member) myType;

}



produces the following error:



test.cpp: In function 'void foobar()':

test.cpp:17:32: internal compiler error: in finish_decltype_type, at

cp/semantics.c:5274



I accidently used the actual class B instead of the template parameter T in the

foobar function and stumbled upon this error. The error is NOT reproducible

when at least ONE of the following points applies:

- the member variable 'member' is not static

- 'foobar' is not a template method

- the expression inside the decltype statement is inside another expression,

e.g. a function call or as an operand to an operator



The typedef expression is not relevant for the error, it also happens when the

decltype expression is used to declare a variable or as a template parameter.

Reply via email to