See attached testcase. Several things can happen when decltype is used in a function template's return type to refer to another specialization of the same template.
- The right thing (not easily produced from the current code, but see http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44162) - Non-production of a candidate, a la SFINAE - g++: Internal error: Segmentation fault (program cc1plus). This happens for me with the given testcase. As the "recursive" type must be dependent, it should be evaluated at the point of instantiation. Using the template's identifier even before it has been defined shouldn't be an issue. The behavior seems to depend on what types are passed to the template in question. Type deduction doesn't seem to matter. Types involving only primitives are likely to quietly fail. Types involving classes may succeed or crash. For example, if I adjust ft<a,2> to ft<int,2>, no crash. -- Summary: [C++0x] decltype sometimes cannot recurse Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: potswa at mac dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44175