Boost logo

Boost :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2003-01-11 15:40:38


----- Original Message -----
From: "Gabriel Dos Reis" <gdr_at_[hidden]>

> "Paul Mensonides" <pmenso57_at_[hidden]> writes:
> | > Yes, but which text in the Standard forbids that?
> |
> | 14.3.1/2 [quote--
> |
> | A local type, a type with no linkage, an unnamed type or a type
compounded
> | from any of these types shall not be used as a template-argument for a
> | template type-parameter.
> |
> | --end quote]
>
> Aha, thanks. I knew of all the other restrictions except the unnamed
> bits. Thanks for your patience.
>
> Incidentely You've found a bug in at least a major compiler.

Which one are you referring to?

...because the EDG front-end does this wrong also:

struct A {
    enum type { x = 1 };
};

template<int> struct abc { };

template<class T> T operator+(T, T) {
    throw 0;
}

int main() {
    typedef abc<A::x + A::x> type;
        // ^
        // this should be an error
        // A::x + A::x is no longer
        // a constant expression

    A::x + A::x; // throws

    return 0;
}

So if that is a different one, then I've found *at least* two! ;)

Paul Mensonides


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