🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by hcl Mon, 08 May 1989 09:03
Bug in constructor for aggregate.
#1955
Author: hcl
Date: Mon, 08 May 1989 09:03
34 lines
939 bytes
Compiler version 1.34.2, SUNoS 4.0 SUN 3

Strousstrup page 287 on members of aggregate - 

- An object can be a member of an aggregate only (1) if the object's
class do not have a constructor, or (2) if one of its constructors
takes no argument ... -

According to this the code below should compile happily as it did
under 1.34.1.

class foo
{
    int i;
public:
    foo() { i = 0;}
};

class bar
{
public:
    foo f[3];
};

main()
{
    bar t;
}

g++ -c  test.cc
In function int main ():
test.cc:16: invalid use of non-lvalue array

				
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads