[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Groff] compiler errors troff 1.19
From: |
Werner LEMBERG |
Subject: |
Re: [Groff] compiler errors troff 1.19 |
Date: |
Sun, 11 May 2003 17:45:55 +0200 (CEST) |
[Antoine, I'm CCing to you in the hope that you know the C++ standard
as well as C.]
> I'm trying to compile groff on Solaris 8 with
> Sun WorkShop 6 2000/06/19 C 5.1 Patch 109491-02. Unfortunately it seems
> to have problems with the code:
>
> CC -I. -I/home/elkner/tmp/build/groff-1.19/src/roff/troff
> -I/home/elkner/tmp/build/groff-1.19/src/include
> -I/home/elkner/tmp/build/groff-1.19/src/include -DHAVE_CONFIG_H
> -xtarget=ultra -xarch=v8plus -xO3 -c div.cpp
>
> "env.h", line 313: Error: Multiple declaration for title_length.
> "env.h", line 314: Error: Multiple declaration for space_size.
> ...
Hmm, in class `environment' defined in env.h we first have
hunits title_length;
declaring a variable. Later then we have (in the same class)
friend void title_length();
to make the function `title_length()' (defined in another file env.cc)
to be a friend function of this class.
It seems that your C++ compiler (contrary to any other I'm aware of)
just looks at the symbol `title_length', ignoring the scope (declaring
a function as `friend' which is in the same class is useless AFAIK).
I'm not sure whether this is a compiler bug or whether this is
undefined behaviour in the C++ standard. Or is this new C++
behaviour? The `natural' way to access a top-level definition could
be
friend void ::title_length();
but this gives a compilation error with my gcc. Saying
friend void std::title_length();
works for me (and probably for you too), but I'm pretty sure that this
fails with older C++ compilers which don't support namespaces;
additionally I believe that this is the wrong approach.
Werner