[Bug c++/20315] New: G++ Problem with two-stage name lookup

2005-03-04 Thread cmarco at indra dot es
I had a derived class template which was making use of two protected 
variables of it’s base class. Now using GCC 3.4.4 (which implements the two-
stage dependant name lookup) I’ve read that you need to use the prefix this-> 
or the prefix BaseClassName 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  class Base {
  int i;
};
template  class Derived : public Base {
   int get_i() {return Base::i;}
};


Preprocessed Code:
# 1 "test.h"
# 1 ""
# 1 ""
# 1 "test.h"
template  class Base {
  int i;
};
template  class Derived : public Base {
   int get_i() {return Base::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


[Bug pch/20315] pch problems on solaris

2005-03-09 Thread cmarco at indra dot es


-- 
   What|Removed |Added

  Component|target  |pch


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20315


[Bug pch/20315] pch problems on solaris

2005-03-17 Thread cmarco at indra dot es

--- 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   indra141 Mar  3 16:49 test.h
sun1:~/test> g++ -m64 -x c++ -c test.h
sun1:~/test> ls -la test*
-rw-r-   1 cmarco   indra141 Mar  3 16:49 test.h
-rw-r-   1 cmarco   indra672 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   indra141 Mar  3 16:49 test.h 
sun1:~/test>  g++ -m64 -x c++ -c test.h
sun1:~/test> ls -la test*
-rw-r-   1 cmarco   indra141 Mar  3 16:49 test.h
-rw-r-   1 cmarco   indra1034879 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


[Bug pch/20315] pch problems on solaris

2005-03-29 Thread cmarco at indra dot es

--- 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