Boost logo

Boost :

From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2007-10-23 15:22:13


Markus Schoepflin wrote:
> I'm wondering if g++ cannot be configured to check for this kind of
> errors? Anyone knows?

If the Standard requires diagnostics for this error (which is something
I'm not sure about), then compiling '-pedantic -ansi' should cause g++
to emit a diagnostics. From g++ man page:

  Some users try to use -pedantic to check programs for strict ISO C
  conformance. They soon find that it does not do quite what they want:
  it finds some non-ISO practices, but not all---only those for which
  ISO C requires a diagnostic, and some others for which diagnostics
  have been added.

  A feature to report any failure to conform to ISO C might be useful
  in some instances, but would require considerable additional work and
  would be quite different from -pedantic. We don't have plans to
  support such a feature in the near future.

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<>();
}

Boris

----- Original Message -----
From: "Markus Schöpflin" <markus.schoepflin_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, October 23, 2007 12:49 PM
Subject: Re: [boost] [fusion] Getting rid of the incomplete type error forvector

Joel de Guzman schrieb:
> Markus Schöpflin wrote:
>> Joel de Guzman wrote:
>>
>> [...]
>>
>>> Confirmed and committed. Jeez! Me smack in the head!!! I did lots of
>>> dependency analysis only to learn (from you) that that file is not
>>> needed there. IIRC, it was needed at one point in the development, but
>>> not anymore.
>> Well, I used a more pragmatic approach: cxx -E ... as_vector.cpp | grep -w
>> vector | less
>
> Well, that's my problem. I do not have access to the compiler.
> Otherwise, I would've found it already. So, I based my hunt on
> pure intuition. The compilers that I use regularly does not
> exhibit the problem.

Uh, I didn't mean to imply any criticism with that. Sorry if I did.

I'm wondering if g++ cannot be configured to check for this kind of
errors? Anyone knows?

Markus

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost


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