[cfe-dev] Semantic form of InitListExpr node not flagged as value dependent.

Enea Zaffanella zaffanella at cs.unipr.it
Fri May 25 06:35:38 PDT 2012

We have found a problem when visiting the AST for the following code:
template <int>
struct A {
   static const int i;

template <int N>
const int A<N>::i = { N };

When visiting the initializer of the out-of-line static field 
definition, we see:

(gdb) p node
$18 = (clang::InitListExpr *) 0x2ffd680
(gdb) call node->dump()
(InitListExpr 0x2ffd680 'int'
   (DeclRefExpr 0x2ffd610 'int' NonTypeTemplateParm 0x2ffd2a0 'N' 'int'))
(gdb) p node->isValueDependent()
$19 = false
(gdb) p node->getSyntacticForm()
$20 = (clang::InitListExpr *) 0x2ffd638
(gdb) call node->getSyntacticForm()->dump()
(InitListExpr 0x2ffd638 'int'
   (DeclRefExpr 0x2ffd610 'int' NonTypeTemplateParm 0x2ffd2a0 'N' 'int'))
(gdb) p node->getSyntacticForm()->isValueDependent()
$21 = true

That is, the syntactic form of the init list expr is (correctly) flagged 
as value dependent, but the semantic form is not.


More information about the cfe-dev mailing list