Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2003-08-30 07:05:27


Brian McNamara <lorgon_at_[hidden]> writes:

> On Thu, Aug 28, 2003 at 03:05:19PM -0400, David Abrahams wrote:
>> Douglas Gregor <gregod_at_[hidden]> writes:
>> > On Thursday 28 August 2003 01:23 pm, David Abrahams wrote:
>> >> The other possible option would have been to simply not give the user
>> >> a readable error message. I'm open to opinions that I chose the
>> >> wrong balance.
>> >
>> > So we're breaking code in order to produce a better error message? This seems
>> > like the wrong trade-off to make, especially because it means it breaks code
>> > when users upgrade from VC6 to VC7; but we want them to upgrade!
>>
>> Anyone got a brilliant way to cause vc7 to print the error message?
>
> More generally, is there a generally accepted strategy for Boost
> libraries to attempt to force compilers to emit useful diagnostics?
>
> I can imagine there are a number of places where this goes on, and so if
> anyone has good domain knowledge about coercing compiliers into emitting
> useful diagnotics, it'd be great to have that written down somewhere (or
> maybe even turned into some macros possibly).
>
> (Kinda a vague idea-specification, I know.)

Unfortunately, typedef substitution makes it nearly impossible on some
compilers, namely EDGs and MSVC7.x:

           template <class T>
           struct X
           {
                typedef int& type;
           };

           template <class U>
           struct Y
           {
                typedef U* type;
           };

           template <class T>
           struct composeYX
              : Y<typename X<T>::type> {};

           typedef composeYX<char>::type z;

Nowhere in that message will you see "int&" on compilers which do
typedef substitution :(

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com

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