[cfe-dev] UninstantiatedDefaultArgument in CXXConstructorDecl instance question

Roman Divacky rdivacky at freebsd.org
Fri Jan 20 04:49:21 PST 2012


Hi,

in this example

template<typename T>
struct bar {
};

bar<int> bbb;

template<typename T>
struct foo {
  foo(bar<T> &b = bbb) { }
};

foo<int> y;

I am trying to get the default arg of foo(bar<int> &b) from CXXConstructorDecl.

The problem is that the ParmVarDecl->getDefaultArg() fails because the
ParmVarDecl has UninstantiatedDefaultArgument even when I am using the
instantiated constructor and param:

(gdb) p CD->dump()
foo(bar<int> &b) { }
(gdb) p (*CD->param_begin())->dump()
bar<int> &b

which looks correct yet the ParmVarDecl hasUninstantiatedDefaultArg().

How is this supposed to work?

thank you, roman



More information about the cfe-dev mailing list