Bug on function templates definitions occurring outside namespace decl.

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug on function templates definitions occurring outside namespace decl.

Enea Zaffanella
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.
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: Bug on function templates definitions occurring outside namespace decl.

Sebastian Redl
Enea Zaffanella wrote:
> 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).
>  
Yes. Please file a bug in Bugzilla, at http://llvm.org/bugs/

Sebastian
_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev