Boost logo

Boost :

From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2003-01-11 16:58:11


"Paul Mensonides" <pmenso57_at_[hidden]> writes:

| ----- 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?

GCC :-)

| ...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! ;)

It seems so.

-- Gaby


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