[Bug c++/60386] New: [C++11] Crash on a template class containing array initialized in-class

2014-03-02 Thread a.matveyakin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60386

Bug ID: 60386
   Summary: [C++11] Crash on a template class containing array
initialized in-class
   Product: gcc
   Version: 4.8.2
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: a.matveyakin at gmail dot com

Using built-in specs.
COLLECT_GCC=/usr/bin/gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.8/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 4.8.2-15ubuntu3'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libmudflap
--enable-plugin --with-system-zlib --disable-browser-plugin
--enable-java-awt=gtk --enable-gtk-cairo
--with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre --enable-java-home
--with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu
Thread model: posix
gcc version 4.8.2 (Ubuntu 4.8.2-15ubuntu3) 


Compiling the code below with “g++ -std=c++11 filename.cpp” causes segmentation
fault in the compiler.


class A
{
};

templatetypename T
class B
{
public:
  A v[1] = {};
};

Bint b;

[Bug c++/53926] New: g++ fails to compile valid template code with casting to QVariant and back

2012-07-11 Thread a.matveyakin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53926

 Bug #: 53926
   Summary: g++ fails to compile valid template code with casting
to QVariant and back
Classification: Unclassified
   Product: gcc
   Version: 4.8.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
AssignedTo: unassig...@gcc.gnu.org
ReportedBy: a.matveya...@gmail.com


Trying to compile the following code:

#include QtCore/QSettings

template typename T
void bug (const T default_value)
{
  QSettings settings;
  settings.value (foo, default_value).value T ();
}

results in compilation failure:

$ gcc -I/usr/include/qt4 -c gcc-bug.cpp 
gcc-bug.cpp: In function ‘void bug(const T)’:
gcc-bug.cpp:7:49: error: expected primary-expression before ‘’ token
gcc-bug.cpp:7:52: error: expected primary-expression before ‘)’ token


The error can be reproduced in a small code piece without any includes:

class Variant
{
public:
  Variant (int) { }

  template typename T
  T value () const { return T (); }
};

template typename T
Variant get_variant (const T x)
{
  return Variant (x);
}

template typename T
void bug (const T x)
{
  get_variant (x).value T ();
}

$ gcc -I/usr/include/qt4 -c gcc-bug.cpp 
gcc-bug.cpp: In function ‘void bug(const T)’:
gcc-bug.cpp:19:27: error: expected primary-expression before ‘’ token
gcc-bug.cpp:19:30: error: expected primary-expression before ‘)’ token


Splitting the line

get_variant (x).value T ();

into

Variant tmp = get_variant (x);
tmp.value T ();

eliminates the error.


The error is reproducible in 4.2.4, 4.5.1, 4.6.3 and 4.8.1 prerelease versions.

ICC  MSVC compile these examples without errors or warnings.


[Bug c++/53926] g++ fails to compile valid template code with casting to QVariant and back

2012-07-11 Thread a.matveyakin at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53926

Andrey Matveyakin a.matveyakin at gmail dot com changed:

   What|Removed |Added

 Status|RESOLVED|UNCONFIRMED
 Resolution|INVALID |

--- Comment #3 from Andrey Matveyakin a.matveyakin at gmail dot com 
2012-07-11 11:49:56 UTC ---
Thank you. Sorry for my mistake.