[Bug c++/49327] New: Parse error involving "templated method inside templated class"

2011-06-08 Thread robinei at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49327

   Summary: Parse error involving "templated method inside
templated class"
   Product: gcc
   Version: 4.5.2
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: robi...@gmail.com


Compiler invocation: "g++ -ftemplate-depth-128 -O0 -fno-inline -Wall -g -c -o
buggy.o buggy.cpp"
Platform: both win32 and linux

I have attached (and pasted) reduced code that exhibit the behavior, with
explanation.

CODE:


template // REMOVE THIS LINE TO REMOVE PROBLEM
struct Delegate {
template 
static void from_method(T *object_ptr) {}
};

template
struct Event {
typedef Delegate DelegateType; // REMOVE  TO REMOVE PROBLEM

template 
void connect_method(T *object_ptr) {
// The following line fails with:
// buggy.cpp:16:36: error: expected primary-expression before '>' token
DelegateType::from_method(object_ptr);
}
};

int main(int argc, char *argv[]) {
return 0;
}


[Bug c++/49327] Parse error involving "templated method inside templated class"

2011-06-08 Thread robinei at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49327

--- Comment #2 from robinei at gmail dot com 2011-06-08 17:35:22 UTC ---
(In reply to comment #1)
> You want:
> 
>   DelegateType::template from_method(object_ptr);

Doh! thanks