[Bug c++/66957] New: irregular "is protected within this context" error

2015-07-21 Thread dreamcooled at gmail dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66957

Bug ID: 66957
   Summary: irregular "is protected within this context" error
   Product: gcc
   Version: 5.1.0
Status: UNCONFIRMED
  Severity: major
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dreamcooled at gmail dot com
  Target Milestone: ---

Created attachment 36023
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=36023&action=edit
The code which produces the bug

In the attachment you find code which I'm trying to compile with g++.

I have a archlinux system and I have g++ version 5.1.0 from the offical repo of
my system.

I'm trying to compile the attached code by invoking 
`g++ classtest.cpp`. 

gcc fires the error:
classtest.cpp: In constructor ‘DerivedB::DerivedB()’:
classtest.cpp:9:5: error: ‘int BaseClass::x’ is protected
 int BaseClass::x;
 ^
classtest.cpp:22:32: error: within this context
 std::cout << DerivedA::x;
^
What I'm trying to achieve is completely legal according to the c++ standard
([class.access.base]/p5 ).

More information, discussion, and a lot of people who agree that this is indeed
a gcc bug, can be found in the associated stackoverflow question:
http://stackoverflow.com/questions/31389470/g-compilation-error-is-protected-from-within-this-context-while-clang-do

[Bug c++/107332] New: internal compiler error: in tsubst_copy, at cp/pt.c:15751

2022-10-20 Thread dreamcooled at gmail dot com via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107332

Bug ID: 107332
   Summary: internal compiler error: in tsubst_copy, at
cp/pt.c:15751
   Product: gcc
   Version: 9.5.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: dreamcooled at gmail dot com
  Target Milestone: ---

I'm getting an ICE when compiling the following program on x86-64 gcc 9.5.
Tried it on godbolt.org with -std=c++17 command line options.
The bug seems to be fixed in > gcc 10.

#include 

template  void Invoke()
{
auto f = [](auto stateIdIntegralConstant) {
if constexpr
(std::integral_constant() == 0)
{
}
};
f(std::integral_constant{});
}

int main()
{
   Invoke();
}


Compiler output:
: In instantiation of 'Invoke() [with T = int]:: [with
auto:1 = std::integral_constant]':
:10:6:   required from 'void Invoke() [with T = int]'
:15:16:   required from here
:6:28: internal compiler error: in tsubst_copy, at cp/pt.c:15751
6 | if constexpr
(std::integral_constant() == 0)
  |   
^~~~
Please submit a full bug report,
with preprocessed source if appropriate.
See <https://gcc.gnu.org/bugs/> for instructions.
Compiler returned: 1


I see there are possible duplicates of this bug, but all are in state
resolved/fixed and I'm not sure if it is really the same bug.
If it is the same bug, I was hoping that the fix could be backported to gcc 9,
since I'm using only standard c++17 without any experimental features...

Thank You.