This is the mail archive of the
mailing list for the GCC project.
Re: auto/decltype question about implementation
niXman <email@example.com> a Ãcrit:
> Can you please tell, auto is implemented based on the decltype
> implementation with some semantics, or they are two completely
> different implementations?
I think they are different.
> And one more question: in which files/functions I can view the
> implementation of auto and decltype?
Generally speaking, the initialization of a declaration is handled in
gcc/cp/decl.c:cp_finish_decl. In that function, G++ detects if the type
of declaration uses 'auto'. If yes, auto-deduction is performed by
If auto is used in the context of a template, then I guess
auto-deduction happens during the substitution of template arguments for
template parameters. For that case, you can look at
gcc/cp/pt.c:tsubst_decl. Look for do_auto_deduction in there.
I hope this helps.