[Bug c++/55245] Compiler segfault when compiling the small test case

2012-11-08 Thread xinliangli at gmail dot com


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



davidxl xinliangli at gmail dot com changed:



   What|Removed |Added



Version|4.7.3   |4.8.0



--- Comment #1 from davidxl xinliangli at gmail dot com 2012-11-09 00:42:55 
UTC ---

The problem actually exists in main line compiler too.


[Bug c++/55245] Compiler segfault when compiling the small test case

2012-11-08 Thread xinliangli at gmail dot com


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



--- Comment #2 from davidxl xinliangli at gmail dot com 2012-11-09 06:05:43 
UTC ---

(In reply to comment #1)

 The problem actually exists in main line compiler too.





This is another test case.



Segfaults without option, but builds ok with -DOK.



The problem seems to be that the main variant of the array type

Vector2float[2] does not have size, while the variant Vector2_f[2] has. The

variant's size later gets reset to 0 (from main variant).



David



template typename VType class Vector2 {

 public:

  Vector2();

  VType x() const;

};

typedef Vector2float Vector2_f;

void GetR(const Vector2_f mosaic_position[3]);

template class C struct DefaultDeleter {

   float  GetColorTexCoord(Vector2_f tex_coord) const  {

return tex_coord.x();

  }

};



class GetT { private: virtual void TestBody(); };



void GetT::TestBody() {

#ifdef OK

  Vector2float mosaic_position[2][3] = { };

#else

  Vector2_f mosaic_position[2][3] = { };

#endif

}