https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64924
Bug ID: 64924
Summary: Callback function passed as a parameter with typename
declaration produces an ICE.
Product: gcc
Version: 4.8.2
Status: UNCONFIRMED
Severity: minor
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: martin.boretto at tallertechnologies dot com
Created attachment 34659
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34659&action=edit
Preprocessed source stored
The code below produces an ICE error:
// --------------------------------------------------
template<typename T>
class PP
{
public:
/**
* @brief Constructor with instance and callback function.
*/
PP(T* instance, typename PP::CallbackFunction callbackFunction);
private:
/**
* @brief callback function.
*/
typedef void (T::*CallbackFunction)(void);
};
template<typename T>
PP<T>::PP(T* instance, CallbackFunction callbackFunction)
{}
// --------------------------------------------------
class JJ
{
public:
/**
* Constructor class.
*/
JJ():
_attr(this, &JJ::m)
{}
/**
* @brief Call back function.
*/
void m()
{}
private:
/** @brief Class attribute instantiated with "this" class. */
PP<JJ> _attr;
};
// --------------------------------------------------
int main(int argc, char const *argv[])
{
JJ juancillo;
return 0;
}
Execution:
g++ -std=c++11 -Wall -Wextra -ansi -pedantic-errors example.cpp -o example