nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

type definition in return type

Von: jens.muaddib@googlemail.com [Profil]
Datum: 03.04.2009 13:30
Message-ID: <d22b65ee-19ab-4bb1-afd0-7215cc07d4d5@z1g2000yqn.googlegroups.com>
Newsgroup: de.comp.lang.iso-c++
Hallo,

ich bin über ein inkonsistentes Verhalten von verschiedenen C++-
Compilern gestoßen. Der folgende Code compiliert auf Microsoft Visual C
++ ohne Fehler oder Warnungen, beim online Comeau-Compiler erhalte ich
aber eine Fehlermeldung:
struct SomeClass
{
int i;
}
f()
{
SomeClass x;
x.i = -1;
return x;
}

void g()
{
f();
SomeClass x = f();
}

Die Fehlermeldung von Comeau-C++ ist:

Comeau C/C++ 4.3.10.1 (Oct  6 2008 11:28:09) for
ONLINE_EVALUATION_BETA2
Copyright 1988-2008 Comeau Computing.  All rights reserved.
MODE:strict errors C++ noC++0x_extensions

"ComeauTest.c", line 1: error: type definition is not allowed in
function return
type declaration
struct SomeClass
^

1 error detected in the compilation of "ComeauTest.c".


Ich würde gerne wissen, welcher Compiler Recht hat. Intuitiv hoffe
ich, dass es der Comeaucompiler ist.

[ Auf dieses Posting antworten ]

Antworten