[Bug c++/27465] New: ICE on dependent const folding

2006-05-06 Thread tneumann at pi3 dot informatik dot uni-mannheim dot de
Performing constant calculations depending on template parameters causes an
internal compiler error. Compile the code below with g++ -c foo.cpp to
reproduce.

template  struct A {
   static const unsigned a = (sizeof(T[3])-sizeof(T[2]));
   unsigned foo(unsigned b) { return a*b; }
};

I do not get the ICE when compiling the code with my distribution compiler
(Ubuntu Dapper gcc 4.0.3), only with my self-compiled 4.0.3 that has checking
enabled. I only noticed this by accident when I build a checking compiler to
hunt a different gcc bug.
My configuration options as shown by g++ -v (mostly copied from the
distribution compiler):
../configure --enable-languages=c,c++ --prefix=/home/tneumann/gcc4
--enable-shared --with-system-zlib --without-included-gettext
--enable-threads=posix --enable-nls --enable-__cxa_atexit --enable-clocale=gnu
--enable-libstdcxx-debug --disable-werror --enable-checking --disable-multilib
x86_64-linux-gnu


-- 
   Summary: ICE on dependent const folding
   Product: gcc
   Version: 4.0.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tneumann at pi3 dot informatik dot uni-mannheim dot de
  GCC host triplet: x86_64-linux-gnu


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



[Bug c++/27465] [4.0 only] ICE on dependent const folding

2006-05-26 Thread tneumann at pi3 dot informatik dot uni-mannheim dot de


--- Comment #3 from tneumann at pi3 dot informatik dot uni-mannheim dot de  
2006-05-26 16:35 ---
This still happens with gcc-4.0-20060518, see the error message below. The
gcc-4.[12] branches presumably work, I only tried 4.1.

./gcc4/bin/g++ -c foo.cpp
foo.cpp: In member function 'unsigned int A::foo(unsigned int)':
foo.cpp:3: internal compiler error: tree check: expected class 'type', have
'type' (array_type) in operand_equal_p, at fold-const.c:2404
Please submit a full bug report,
with preprocessed source if appropriate.
See http://gcc.gnu.org/bugs.html> for instructions.


-- 

tneumann at pi3 dot informatik dot uni-mannheim dot de changed:

   What|Removed |Added

 Status|WAITING |UNCONFIRMED


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



[Bug libstdc++/21193] provide better std::tr1::hash for std::string and std::wstring

2005-07-06 Thread tneumann at pi3 dot informatik dot uni-mannheim dot de

--- Additional Comments From tneumann at pi3 dot informatik dot 
uni-mannheim dot de  2005-07-06 07:42 ---
How about using a union-cast to hash floating point numbers? Something like this

unsigned hash(double v) {
   union { double a; unsigned long long b; } tmp;
   tmp.a=v; return tmp.b^(tmp.b>>32);
}

The code is only a sketch (assumes 32bit unsigned etc.) but should produce much 
better results than the current hash function. It should also avoid the 
problems 
with unordered_set mentioned on the mailing list.
The main disadvantage is that it forces memory access, which is somewhat slow.
Another problem is that the resulting hash value is not portable, but this is 
probably ok.


-- 


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


[Bug c++/22354] New: g++ accepts specializiation without declaration

2005-07-07 Thread tneumann at pi3 dot informatik dot uni-mannheim dot de
According to the C++ standard each member specialization has to be declared 
before use. G++ accepts usage without prior declaration, see the thread 
starting 
at http://gcc.gnu.org/ml/gcc-help/2005-07/msg00074.html for a discussion.

The code shown below is accepted by g++ 4.0 (and 3.3 and 3.4), however it 
should 
report an error as Comeau and icc does. It should require the declarations 
which 
are commented out.

struct A {
 const A* a;
};

template  struct B {
 static const A b;
};

extern const char c[1]="";
extern const char d[1]="";

// Should be required, g++ does not need them
//template<> const A B::b;
//template<> const A B::b;

template<> const A B::b ={&B::b};
template<> const A B::b ={&B::b};

-- 
   Summary: g++ accepts specializiation without declaration
   Product: gcc
   Version: 4.0.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tneumann at pi3 dot informatik dot uni-mannheim dot de
CC: gcc-bugs at gcc dot gnu dot org


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


[Bug c++/21181] New: namespace lookup error message misleading

2005-04-23 Thread tneumann at pi3 dot informatik dot uni-mannheim dot de
Consider the following C++ code:

class A;
namespace X {
class B { friend class A; };
}
using namespace X;
class A {};
A a;

In the last line the compiler complains that A is undefined. After reading the 
release notes I understamd what happens (although I'm surprised. E.g. Comeau 
accepts the code). 
However the error message is very misleading: The problem is not that A is 
undefined but that X::A is undefined! This is very confusing for users.

-- 
   Summary: namespace lookup error message misleading
   Product: gcc
   Version: 4.0.0
Status: UNCONFIRMED
  Severity: enhancement
  Priority: P2
 Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tneumann at pi3 dot informatik dot uni-mannheim dot de
CC: gcc-bugs at gcc dot gnu dot org


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