Boost logo

Boost :

From: Sebastian Redl (sebastian.redl_at_[hidden])
Date: 2007-10-23 16:16:20


Boris Gubenko wrote:
> For the program below, in strict ansi mode, EDG Front End issues an
> error: "incomplete type is not allowed" (and, accordingly, cxx and aC++
> issue this error also). g++ 4.2.1 does not issue any diagnostics, even
> when compiling '-pedantic -ansi'. Again, I'm not sure if a diagnostics is
> required in this case.
>
> template <typename T>
> struct apply {
> typedef T type;
> };
>
> template <typename T = void>
> struct vector;
>
> template <typename Iterator>
> static typename apply<Iterator>::type
> call(Iterator)
> {
> return vector<>();
> }
>
See 14.6/5:
> No diagnostic shall be issued for a tem-
> plate definition for which a valid specialization can be generated.
> If no valid specialization can be generated for a template definition,
> and that template is not instantiated, it is unspecified whether or
> not an implementation is required to issue a diagnostic.
The implementation is allowed to defer issuing a diagnostic until the
function is instantiated.

Sebastian Redl


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk