[Bug c++/114525] New: Incorrect code generated when setting a value through a pointer-to-member on a ternary returning an object reference

2024-03-28 Thread dragonroot at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114525

Bug ID: 114525
   Summary: Incorrect code generated when setting a value through
a pointer-to-member on a ternary returning an object
reference
   Product: gcc
   Version: 14.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dragonroot at gmail dot com
  Target Milestone: ---

The following program incorrectly outputs 1 on every GCC I've tried (via
godbolt.org), while every clang version there correctly outputs 2.

==
#include 

struct Foo
{
  int x;
};

Foo & get( Foo & v )
{
  return v;
}

int main()
{
  Foo v;

  v.x = 1;

  bool cond = true;

  ( cond ? get( v ) : get( v ) ).*( ::x ) = 2;

  // Should output 2, but outputs 1
  printf( "%d\n", v.x );
}
==

[Bug c++/67870] ICE: in type_throw_all_p, at cp/except.c:1306

2015-10-06 Thread dragonroot at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67870

--- Comment #1 from Konstantin Isakov  ---
$ g++-4.9 --std=c++11 bug.cc 
bug.cc: In destructor ‘Foo::~Foo()’:
bug.cc:17:3: internal compiler error: in type_throw_all_p, at cp/except.c:1306
   {}
   ^
Please submit a full bug report,
with preprocessed source if appropriate.

$ g++-4.9 --version
g++-4.9 (Debian 4.9.3-4) 4.9.3

[Bug c++/67870] New: ICE: in type_throw_all_p, at cp/except.c:1306

2015-10-06 Thread dragonroot at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67870

Bug ID: 67870
   Summary: ICE: in type_throw_all_p, at cp/except.c:1306
   Product: gcc
   Version: 4.9.3
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dragonroot at gmail dot com
  Target Milestone: ---

The following code snippet makes the compiler ICE. Affects at least 4.8.2 and
4.9.3. Does not seem to affect 5.x. Compile with --std=c++11

==

#include 

template< class T >
struct Tmpl
{
  ~Tmpl() noexcept( std::is_nothrow_destructible< T >::value )
  {}
};

struct Empty
{
};

struct Foo
{
  ~Foo()
  {}

  Tmpl< Empty > member;
};

int main()
{
}

==

Live snippet to play with: http://melpon.org/wandbox/permlink/6vmp1P7Ppwzjk1kh


[Bug c++/58187] New: Initialization of a non-static data member using a template argument doesn't work when the template is inside of another class

2013-08-18 Thread dragonroot at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58187

Bug ID: 58187
   Summary: Initialization of a non-static data member using a
template argument doesn't work when the template is
inside of another class
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dragonroot at gmail dot com

The following does not compile:

== test.cc =
struct Bar
{
  template unsigned v 
  struct Foo
  {
unsigned value = v;
  };
};


$ g++-4.8 -c -std=c++11 test.cc 

test.cc:6:22: error: ‘v’ was not declared in this scope
 unsigned value = v;
  ^

$ g++-4.8 --version
g++-4.8 (Debian 4.8.1-9) 4.8.1
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[Bug c++/58188] New: ICE in gimple_add_tmp_var, at gimplify.c:738

2013-08-18 Thread dragonroot at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58188

Bug ID: 58188
   Summary: ICE in gimple_add_tmp_var, at gimplify.c:738
   Product: gcc
   Version: 4.8.1
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dragonroot at gmail dot com

The following code causes an ICE:

 test.cc =
struct B {};
struct A
{
  A( B );
};

struct Bar
{
  template unsigned v 
  struct Foo
  {
A z = B();
unsigned value;
Foo(): value( v ) {}
  };

  struct Baz
  {
Foo 8  foo1;
Foo 1  foo3;
  };
};

Bar::Baz baz;
===


$ g++-4.8 -c -std=c++11 test.cc 
test.cc: In constructor ‘Bar::Foov::Foo() [with unsigned int v = 1u]’:
test.cc:14:21: internal compiler error: in gimple_add_tmp_var, at
gimplify.c:738
 Foo(): value( v ) {}
 ^
...

P.S. This might possibly be related to bug 58187.