public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/20315] New: G++ Problem with two-stage name lookup
@ 2005-03-04 11:59 cmarco at indra dot es
2005-03-04 15:15 ` [Bug target/20315] pch problems on solaris bangerth at dealii dot org
` (8 more replies)
0 siblings, 9 replies; 10+ messages in thread
From: cmarco at indra dot es @ 2005-03-04 11:59 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 4590 bytes --]
I had a derived class template which was making use of two protected
variables of its base class. Now using GCC 3.4.4 (which implements the two-
stage dependant name lookup) Ive read that you need to use the prefix this->
or the prefix BaseClassName<T> to avoid getting a undeclared variable message,
but it doesn´t work, at least with this version of the compiler. When you
compile with the m64 option, the first time the compiler not generate the .o
file just generate a .gch file and if you repeat the operation !!?, the
internal compiler error message appear.
If you compile at 32 bits generate the .gch file in ever occasion you compile
it but the error message not appear.?
I have tried the flag fpermissive without luck.
We are compiling with 64 bits. Do you now any work around?
Code:
template <typename T> class Base {
int i;
};
template <typename T> class Derived : public Base<T> {
int get_i() {return Base<T>::i;}
};
Preprocessed Code:
# 1 "test.h"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "test.h"
template <typename T> class Base {
int i;
};
template <typename T> class Derived : public Base<T> {
int get_i() {return Base<T>::i;}
};
Problem :
sun1:~/test> g++ -m64 -Wno-deprecated -x c++ -c test.h
cc1plus: internal compiler error: in default_pch_valid_p, at ./toplev.c:4142
Please submit a full bug report,
with preprocessed source if appropriate.
Bug Information:
sun1:~/test> g++ -v -save-temps -m64 -Wno-deprecated -x c++ -c test.h
Reading specs from /usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/specs
Configured with: ./configure --prefix=/usr/users/afernand/comp/gcc-bootstrap-
34 --enable-language=c --without-headers --disable-shared :
(reconfigured) ./configure --prefix=/usr/users/afernand/comp/gcc-bootstrap-34 -
-enable-language=c --without-headers --disable-shared :
(reconfigured) ./configure --prefix=/usr/users/afernand/comp/gcc-bootstrap-34 -
-enable-language=c --without-headers --disable-shared :
(reconfigured) ./configure --prefix=/usr/users/afernand/comp/gcc-34 --enable-
language=c,c++
Thread model: posix
gcc version 3.4.4 20041222 (prerelease)
/usr/local/gcc-34/bin/../libexec/gcc/sparc-sun-solaris2.9/3.4.4/cc1plus -E -
quiet -v -iprefix /usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/ -D__arch64__ -D__sparcv9 test.h -mptr64 -mstack-bias -mno-
v8plus -mcpu=v9 -m64 -Wno-deprecated -o test.ii
ignoring nonexistent directory "/usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../sparc-sun-solaris2.9/include"
ignoring nonexistent directory "/usr/local/include"
ignoring nonexistent directory "/usr/users/afernand/comp/gcc-34/lib/gcc/sparc-
sun-solaris2.9/3.4.4/../../../../sparc-sun-solaris2.9/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../include/c++/3.4.4
/usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../include/c++/3.4.4/sparc-sun-solaris2.9
/usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../include/c++/3.4.4/backward
/usr/local/gcc-34/bin/../lib/gcc/sparc-sun-solaris2.9/3.4.4/include
/usr/users/afernand/comp/gcc-34/lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../include/c++/3.4.4
/usr/users/afernand/comp/gcc-34/lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../include/c++/3.4.4/sparc-sun-solaris2.9
/usr/users/afernand/comp/gcc-34/lib/gcc/sparc-sun-
solaris2.9/3.4.4/../../../../include/c++/3.4.4/backward
/usr/users/afernand/comp/gcc-34/include
/usr/users/afernand/comp/gcc-34/lib/gcc/sparc-sun-solaris2.9/3.4.4/include
/usr/include
End of search list.
/usr/local/gcc-34/bin/../libexec/gcc/sparc-sun-solaris2.9/3.4.4/cc1plus -
fpreprocessed test.ii -mptr64 -mstack-bias -mno-v8plus -mcpu=v9 -quiet -
dumpbase test.h -m64 -auxbase test -Wno-deprecated -version -o test.s --output-
pch=test.h.gch
GNU C++ version 3.4.4 20041222 (prerelease) (sparc-sun-solaris2.9)
compiled by GNU C version 3.4.4 20041222 (prerelease).
GGC heuristics: --param ggc-min-expand=65 --param ggc-min-heapsize=65536
Waiting to hear from you soon.
Best Regards.
--
Summary: G++ Problem with two-stage name lookup
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: cmarco at indra dot es
CC: cmarco at indra dot es,gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug target/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
@ 2005-03-04 15:15 ` bangerth at dealii dot org
2005-03-09 8:35 ` [Bug pch/20315] " cmarco at indra dot es
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: bangerth at dealii dot org @ 2005-03-04 15:15 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From bangerth at dealii dot org 2005-03-04 15:15 -------
This seems to be more a problem of precompiled headers on solaris than
anything else...
W.
--
What |Removed |Added
----------------------------------------------------------------------------
Component|c++ |target
GCC host triplet| |sparc-sun-solaris2.9
GCC target triplet| |sparc-sun-solaris2.9
Summary|G++ Problem with two-stage |pch problems on solaris
|name lookup |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
2005-03-04 15:15 ` [Bug target/20315] pch problems on solaris bangerth at dealii dot org
@ 2005-03-09 8:35 ` cmarco at indra dot es
2005-03-09 9:13 ` ebotcazou at gcc dot gnu dot org
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cmarco at indra dot es @ 2005-03-09 8:35 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Component|target |pch
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
2005-03-04 15:15 ` [Bug target/20315] pch problems on solaris bangerth at dealii dot org
2005-03-09 8:35 ` [Bug pch/20315] " cmarco at indra dot es
@ 2005-03-09 9:13 ` ebotcazou at gcc dot gnu dot org
2005-03-16 10:53 ` ebotcazou at gcc dot gnu dot org
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-03-09 9:13 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |ebotcazou at gcc dot gnu dot
| |org
GCC build triplet| |sparc-sun-solaris2.9
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
` (2 preceding siblings ...)
2005-03-09 9:13 ` ebotcazou at gcc dot gnu dot org
@ 2005-03-16 10:53 ` ebotcazou at gcc dot gnu dot org
2005-03-17 8:56 ` cmarco at indra dot es
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-03-16 10:53 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2005-03-16 10:53 -------
Confirmed, but the question is why do you need to generate the PCH twice?
Header files never produce object files, unlike in Ada. Also removing the PCH
file is enough to solve the problem.
--
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |minor
Status|UNCONFIRMED |WAITING
Priority|P2 |P3
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
` (3 preceding siblings ...)
2005-03-16 10:53 ` ebotcazou at gcc dot gnu dot org
@ 2005-03-17 8:56 ` cmarco at indra dot es
2005-03-17 10:35 ` ebotcazou at gcc dot gnu dot org
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: cmarco at indra dot es @ 2005-03-17 8:56 UTC (permalink / raw)
To: gcc-bugs
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 2169 bytes --]
------- Additional Comments From cmarco at indra dot es 2005-03-17 08:55 -------
(In reply to comment #2)
> Confirmed, but the question is why do you need to generate the PCH twice?
> Header files never produce object files, unlike in Ada. Also removing the
PCH
> file is enough to solve the problem.
Perhahs, I have a concept problem. If you have a c++ template in a ".h"
file without a ".c" file and you compile it you should obtain a .o object. I
do not need any .gch file
So this happens with the 3.2.3 version.
sun1:~/test> g++ -v
Reading specs from /usr/local/gcc-3.2.3/bin/../lib/gcc-lib/sparc-sun-
solaris2.9/3.2.3/specs
Configured with: ./configure --prefix=/usr/users/afernand/comp/gcc-3.2.3 -
enable-language=c,c++
Thread model: posix
gcc version 3.2.3
sun1:~/test> ls -la test*
-rw-r----- 1 cmarco indra 141 Mar 3 16:49 test.h
sun1:~/test> g++ -m64 -x c++ -c test.h
sun1:~/test> ls -la test*
-rw-r----- 1 cmarco indra 141 Mar 3 16:49 test.h
-rw-r----- 1 cmarco indra 672 Mar 17 09:18 test.o
Now if I use the 3.4.4 version:
sun1:~/test> g++ -v
Reading specs from /usr/local/gcc-34/bin/../lib/gcc/sparc-sun-
solaris2.9/3.4.4/specs
Configured with: ./configure --prefix=/usr/users/afernand/comp/gcc-bootstrap-
34 --enable-language=c --without-headers --disable-shared :
(reconfigured) ./configure --prefix=/usr/users/afernand/comp/gcc-bootstrap-34 -
-enable-language=c --without-headers --disable-shared :
(reconfigured) ./configure --prefix=/usr/users/afernand/comp/gcc-bootstrap-34 -
-enable-language=c --without-headers --disable-shared :
(reconfigured) ./configure --prefix=/usr/users/afernand/comp/gcc-34 --enable-
language=c,c++
Thread model: posix
gcc version 3.4.4 20041222 (prerelease)
sun1:~/test> ls -la test*
-rw-r----- 1 cmarco indra 141 Mar 3 16:49 test.h
sun1:~/test> g++ -m64 -x c++ -c test.h
sun1:~/test> ls -la test*
-rw-r----- 1 cmarco indra 141 Mar 3 16:49 test.h
-rw-r----- 1 cmarco indra 1034879 Mar 17 09:23 test.h.gch
Something have change. ¿Should I have use other options?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
` (4 preceding siblings ...)
2005-03-17 8:56 ` cmarco at indra dot es
@ 2005-03-17 10:35 ` ebotcazou at gcc dot gnu dot org
2005-03-29 18:54 ` ebotcazou at gcc dot gnu dot org
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-03-17 10:35 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2005-03-17 10:28 -------
> Perhahs, I have a concept problem. If you have a c++ template in a ".h"
> file without a ".c" file and you compile it you should obtain a .o object.
No, you're forcing the compilation with -x c++. Try without -x and see what the
3.2.3 compiler says.
The bottom line is that you should never compile a header file, except if you
want to get the corresponding PCH file.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
` (5 preceding siblings ...)
2005-03-17 10:35 ` ebotcazou at gcc dot gnu dot org
@ 2005-03-29 18:54 ` ebotcazou at gcc dot gnu dot org
2005-03-30 7:36 ` cmarco at indra dot es
2005-04-20 2:20 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: ebotcazou at gcc dot gnu dot org @ 2005-03-29 18:54 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From ebotcazou at gcc dot gnu dot org 2005-03-29 18:54 -------
Maybe this can be fixed by disabling PCH generation when -x is passed.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |NEW
Ever Confirmed| |1
Last reconfirmed|0000-00-00 00:00:00 |2005-03-29 18:54:09
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
` (6 preceding siblings ...)
2005-03-29 18:54 ` ebotcazou at gcc dot gnu dot org
@ 2005-03-30 7:36 ` cmarco at indra dot es
2005-04-20 2:20 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: cmarco at indra dot es @ 2005-03-30 7:36 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From cmarco at indra dot es 2005-03-30 07:35 -------
Like you said, using the prefix "BaseClassTemplate::" and not compiling the .h
template file, just compiling the .c files that use this .h template file
works fine.
--
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |FIXED
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Bug pch/20315] pch problems on solaris
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
` (7 preceding siblings ...)
2005-03-30 7:36 ` cmarco at indra dot es
@ 2005-04-20 2:20 ` pinskia at gcc dot gnu dot org
8 siblings, 0 replies; 10+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-04-20 2:20 UTC (permalink / raw)
To: gcc-bugs
--
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.0.0
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2005-04-20 2:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-03-04 11:59 [Bug c++/20315] New: G++ Problem with two-stage name lookup cmarco at indra dot es
2005-03-04 15:15 ` [Bug target/20315] pch problems on solaris bangerth at dealii dot org
2005-03-09 8:35 ` [Bug pch/20315] " cmarco at indra dot es
2005-03-09 9:13 ` ebotcazou at gcc dot gnu dot org
2005-03-16 10:53 ` ebotcazou at gcc dot gnu dot org
2005-03-17 8:56 ` cmarco at indra dot es
2005-03-17 10:35 ` ebotcazou at gcc dot gnu dot org
2005-03-29 18:54 ` ebotcazou at gcc dot gnu dot org
2005-03-30 7:36 ` cmarco at indra dot es
2005-04-20 2:20 ` pinskia at gcc dot gnu dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).