[boost.test] Visibility problem in fixed_mapping.hpp

In my efforts to make boost.test compile with tru64cxx65 I came about the following issue. Currently, class fixed_mapping contains a private member called elem_type which is later on used in the inline definition of an operator() contained in two inline structs. class fixed_mapping { typedef ... elem_type; struct p1 : public ... { bool operator()(elem_type const &x, ...) { ... } } }; My compiler complains that elem_type is inaccessible in the definition of operator() and I think it is right to complain. I fixed this by making elem_type public, but possibly operator() could be made a friend of fixed mapping as well. Markus

On Thu, Aug 12, 2004 at 06:36:32PM +0200, Markus Sch?pflin wrote:
In my efforts to make boost.test compile with tru64cxx65 I came about the following issue.
Currently, class fixed_mapping contains a private member called elem_type which is later on used in the inline definition of an operator() contained in two inline structs.
class fixed_mapping { typedef ... elem_type;
struct p1 : public ... { bool operator()(elem_type const &x, ...) { ... } } };
My compiler complains that elem_type is inaccessible in the definition of operator() and I think it is right to complain.
There's a defect report about this. The proposed resolution says that nested classes should have the same access rights as member functions, but it hasn't been approved yet IIRC. I think g++ implements the proposed resolution already. jon -- Some things have to be believed to be seen. - Ralph Hodgson

On Thu, Aug 12, 2004 at 05:47:29PM +0100, Jonathan Wakely wrote:
On Thu, Aug 12, 2004 at 06:36:32PM +0200, Markus Sch?pflin wrote:
In my efforts to make boost.test compile with tru64cxx65 I came about the following issue.
Currently, class fixed_mapping contains a private member called elem_type which is later on used in the inline definition of an operator() contained in two inline structs.
class fixed_mapping { typedef ... elem_type;
struct p1 : public ... { bool operator()(elem_type const &x, ...) { ... } } };
My compiler complains that elem_type is inaccessible in the definition of operator() and I think it is right to complain.
There's a defect report about this. The proposed resolution says that nested classes should have the same access rights as member functions, but it hasn't been approved yet IIRC.
DRs 45 and 10 are the ones that apply. Both are WP status. jon -- "Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning." - Rich Cook

Jonathan Wakely wrote:
On Thu, Aug 12, 2004 at 06:36:32PM +0200, Markus Sch?pflin wrote:
class fixed_mapping { typedef ... elem_type;
struct p1 : public ... { bool operator()(elem_type const &x, ...) { ... } } };
My compiler complains that elem_type is inaccessible in the definition of operator() and I think it is right to complain.
There's a defect report about this. The proposed resolution says that nested classes should have the same access rights as member functions, but it hasn't been approved yet IIRC.
But hat still means that currently boost.test needs to be fixed, right?
I think g++ implements the proposed resolution already.
cxx accepts the code also, but not in strict_ansi mode. :-) Markus
participants (3)
-
Jonathan Wakely
-
Markus Schöpflin
-
Markus Schöpflin