Only g++-3.4.2 performs well and gives correct results if and only if it is compiled with -O2. Basically dx function takes an argument of type ***AssemblyTerm<0, Simplex, _2D, P2>,*** and returns ***AssemblyTerm<1, Simplex, _2D, P2>.*** Then in the main I declare
AssemblyTerm<0, Simplex, _2D, P2> v(mesh, &Vec); and AssemblyTerm<1, Simplex, _2D, P2> vdx(mesh, &Vec); just to compare the output of dx(v)(i,x,y,z) with vdx(i,x,y,z) which should both give the same result. Unfortunately although the output is the same (only with g++ --all versions-- -O2) before the declaration of typedef typeof(dx(u)*dx(v)) dxType; dxType A=dx(u)*dx(v); after that declaration the output changes; I do not know for what reason. g++-3.4.2 has no problem if with(-O2) but the other compilers fail to give correct result when we do not comment out the typedef declaration. -- Summary: wrong result without -O2 with g++-3.4.2 and completely wrong result with any other g++ version Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: critical Priority: P1 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: dkouroun at mailbox dot gr CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: GCC-4.0-20041017 GCC host triplet: GCC-3.3.1 SuSE Linux 9.0 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18049