This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/16375] New: typeof() in class definition


class A {
public:
    int a;
    typeof(a) b;
};

int main() {
    class A a;
    a.b = 0;
    return a.b;
}

nowak@debian:/usr/home/nowak$ g++ -Wall test.cpp
test.cpp:4: error: invalid use of member `A::a'
test.cpp:4: error: ISO C++ forbids declaration of `b' with no type

or with 'this'

class A {
public:
    int a, b;
    typeof(*this)* pPrev;
    typeof(*this)* pNext;
};

int main() {
    class A a;
    a.b = 0;
    return a.b;
}

nowak@debian:/usr/home/nowak$ g++ -Wall test.cpp
test.cpp:4: error: invalid use of `this' at top level
test.cpp:4: error: ISO C++ forbids declaration of `pPrev' with no type
test.cpp:5: error: invalid use of `this' at top level
test.cpp:5: error: ISO C++ forbids declaration of `pNext' with no type

-- 
           Summary: typeof() in class definition
           Product: gcc
           Version: 3.3.4
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nowak at xpam dot de
                CC: gcc-bugs at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16375


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]