[cfe-dev] Bug on function templates definitions occurring outside namespace decl.

Enea Zaffanella zaffanella at cs.unipr.it
Sat Jan 30 06:46:44 CST 2010


Hello.

The following code shows a CLANG bug when a function template declared 
inside a namespace decl is later defined outside of the namespace decl.
(Hoping that function template support is mature enough to welcome this 
kind of bug reports).

==============================
namespace N {
template <typename T>
void bar(T);
}

template <typename T>
void N::bar(T) { }
==============================

Clang complains that as follows:

==============================
$ llvm/Debug/bin/clang++ -fsyntax-only bug.cc
bug.cc:7:9: error: variable 'bar' declared as a template
void N::bar(T) { }
         ^
bug.cc:7:13: error: 'T' does not refer to a value
void N::bar(T) { }
             ^
bug.cc:6:20: note: declared at
template <typename T>
                    ^
bug.cc:7:15: error: expected ';' at end of declaration
void N::bar(T) { }
               ^
               ;
bug.cc:7:16: error: expected unqualified-id
void N::bar(T) { }
                ^
5 diagnostics generated.
==============================

Cheers,
Enea Zaffanella.


More information about the cfe-dev mailing list