Skip to content
Snippets Groups Projects
Commit fe548eb8 authored by Patrick Palka's avatar Patrick Palka
Browse files

c++: merge default targs for function templates [PR65396]

We currently merge default template arguments for class templates, but
not for function templates.  This patch fixes this by factoring out the
argument merging logic in redeclare_class_template into a separate
function and using it in duplicate_decls as well.

	PR c++/65396

gcc/cp/ChangeLog:

	* cp-tree.h (merge_default_template_args): Declare.
	* decl.cc (merge_default_template_args): Define, factored out
	from redeclare_class_template.
	(duplicate_decls): Use it when merging member function template
	and free function declarations.
	* pt.cc (redeclare_class_template): Factor out default argument
	merging logic into merge_default_template_args.  Improve location
	of a note when there's a template parameter kind mismatch.

gcc/testsuite/ChangeLog:

	* g++.dg/cpp0x/vt-34314.C: Adjust expected location of
	"redeclared here" note.
	* g++.dg/template/pr92440.C: Likewise.
	* g++.old-deja/g++.pt/redecl1.C: Adjust expected location of
	"redefinition of default argument" error.
	* g++.dg/template/defarg23.C: New test.
	* g++.dg/template/defarg23a.C: New test.
parent 4470e813
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment