------- Comment #9 from jakub at gcc dot gnu dot org 2007-11-20 12:58 ------- Calling middle-end aggregate_value_p on a dependent type certainly is not the right thing to do. It can't possibly do the right thing for various C++ specific type tree codes anyway.
I wonder if the easiest fix wouldn't be adding a bool argument to allocate_struct_function, which would prohibit calling aggregate_value_p in there and setting current_function_returns_{,pcc_}struct. The C++ frontend would then pass dependent_type_p (restype) as this argument, all other FEs and middle-end would pass false. The C++ FE certainly doesn't need current_function_returns_pcc_struct value in templates and current_function_returns_struct, while used once in the FE, can't make much sense for dependent types. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34081