[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
oset-c++: Avoid compilation error with nvc++ 22.1
From: |
Bruno Haible |
Subject: |
oset-c++: Avoid compilation error with nvc++ 22.1 |
Date: |
Sat, 15 Jan 2022 19:52:21 +0100 |
With the nvc and nvc++ compilers, I get this compilation error:
nvc++ -DHAVE_CONFIG_H -DEXEEXT=\"\" -I. -I../../gltests -I..
-DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I..
-I../../gltests/.. -I../gllib -I../../gltests/../gllib
-I/home/bruno/prefix-nvc/include -Wall -g -O2 -c -o test-oset-c++.o
../../gltests/test-oset-c++.cc
"../../gltests/../gllib/gl_oset.hh", line 160: warning: class template
"gl_OSet<ELTYPE *>" has no member "begin"
friend iterator gl_OSet::begin ();
^
"../../gltests/../gllib/gl_oset.hh", line 162: error: declaration is
incompatible with function template "gl_OSet<const char *>::iterator
gl_OSet<ELTYPE *>::begin_atleast(bool (*)(const char *, THT *), THT *) [with
ELTYPE=const char]" (declared at line 193)
friend iterator gl_OSet::begin_atleast (bool (*) (ELTYPE *, THT *), THT
*);
^
detected during instantiation of class "gl_OSet<ELTYPE *>::iterator
[with ELTYPE=const char]" at line 60 of "../../gltests/test-oset-c++.cc"
"../../gltests/../gllib/gl_oset.hh", line 195: error: "gl_OSet<ELTYPE
*>::iterator::iterator(gl_oset_t, bool (*)(ELTYPE *, THT *), THT *) [with
ELTYPE=const char, THT=const char]" (declared at line 170) is inaccessible
{ return iterator (_ptr, threshold_fn, threshold); }
^
detected during instantiation of "gl_OSet<ELTYPE *>::iterator
gl_OSet<ELTYPE *>::begin_atleast(bool (*)(ELTYPE *, THT *), THT *) [with
ELTYPE=const char, THT=const char]" at line 87 of
"../../gltests/test-oset-c++.cc"
2 errors detected in the compilation of "../../gltests/test-oset-c++.cc".
This patch fixes it.
Note that the compiler defines both __EDG__ and __PGIC__. The former apparently
describes the C++ frontend, the latter the code generation phase.
2022-01-15 Bruno Haible <bruno@clisp.org>
oset-c++: Avoid compilation error with nvc++ 22.1.
* lib/gl_oset.hh: With EDG C++ compilers, avoid 'friend'.
diff --git a/lib/gl_oset.hh b/lib/gl_oset.hh
index d1bb4893f6..4fae4eb4d6 100644
--- a/lib/gl_oset.hh
+++ b/lib/gl_oset.hh
@@ -153,7 +153,7 @@ public:
~iterator ()
{ gl_oset_iterator_free (&_state); }
- #if defined __xlC__ || defined __HP_aCC || defined __SUNPRO_CC
+ #if defined __xlC__ || defined __HP_aCC || defined __SUNPRO_CC || defined
__EDG__
public:
#else
private:
- oset-c++: Avoid compilation error with nvc++ 22.1,
Bruno Haible <=