Uninstantiated default argument handling issue

Abramo Bagnara abramo.bagnara at bugseng.com
Sat Nov 8 01:21:48 PST 2014

template<typename T> void f2(T a, T b = T()) { }

void m() {

Checking the AST generated for the source above I've seen that the
default argument expression is not instantiated in specialization of
function f2, but instead such transformation is done (and redone) in the
calls to f2.

In this way:

- we have dependent expr in the declaration of fully instantiated
functions (that is unexpected, at least for me)

- we have multiple copies of the same expression (one for each call)

Is this deliberate?

Abramo Bagnara

BUGSENG srl - http://bugseng.com
mailto:abramo.bagnara at bugseng.com

More information about the cfe-commits mailing list