[Bug c++/89612] New: internal compiler error: in push_access_scope, at cp/pt.c:237

2019-03-06 Thread peter.cpp at sommerlad dot ch
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=89612

Bug ID: 89612
   Summary: internal compiler error: in push_access_scope, at
cp/pt.c:237
   Product: gcc
   Version: 8.2.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: peter.cpp at sommerlad dot ch
  Target Milestone: ---

Created attachment 45907
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=45907&action=edit
preprocessed source for ICE

my code for implementing P0052 unique_resource gets an ICE with the following
constellation:

* template class with CTAD
* friend declaration of template factory function with conditional noexcept
* template factory function with conditional noexcept for this class (the
friend)

- example code triggering ice -

#include 

template
struct unique_resource
{
   template
>
unique_resource(RR &&r, DD &&d)
noexcept(true)
{}
template
friend
auto make_unique_resource_checked(MR &&r, const S &invalid, MD &&d)
noexcept(std::is_nothrow_constructible_v,MR> &&
std::is_nothrow_constructible_v,MD>)
;
};
template
unique_resource(R, D)
-> unique_resource;

template
[[nodiscard]]
auto make_unique_resource_checked(R &&r, const S &invalid, D &&d)
noexcept(std::is_nothrow_constructible_v,R> &&
std::is_nothrow_constructible_v,D>)
{
}

int main() {
auto guard=unique_resource(0,[]{});
}

-- end example -

compilation command and output:

g++ -std=c++17 -O0 -g3 -pedantic -Wall -Wextra -c -fmessage-length=0
-Wno-attributes -save-temps -MMD -MP -MF"src/gcc-ice-test.d"
-MT"src/gcc-ice-test.o" -o "src/gcc-ice-test.o" "../src/gcc-ice-test.cpp"
../src/gcc-ice-test.cpp: In instantiation of 'template auto make_unique_resource_checked(MR&&, const S&, MD&&)':
../src/gcc-ice-test.cpp:14:7:   required from 'struct unique_resource >'
../src/gcc-ice-test.cpp:34:36:   required from here
../src/gcc-ice-test.cpp:14:7: internal compiler error: in push_access_scope, at
cp/pt.c:237
  auto make_unique_resource_checked(MR &&r, const S &invalid, MD &&d)
   ^~~~
---end

preprocessed source attached

[Bug c++/106366] New: CTAD fails to prioritize initializer_list when done via Deduction guide and inherited CTORS

2022-07-19 Thread peter.cpp at sommerlad dot ch via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106366

Bug ID: 106366
   Summary: CTAD fails to prioritize initializer_list when done
via Deduction guide and inherited CTORS
   Product: gcc
   Version: unknown
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: peter.cpp at sommerlad dot ch
  Target Milestone: ---

The following code fails to compile on trunk, 12.1 and all 11 versions of g++ I
tried and compiles fine with clang and msvc:

#include 
template
struct Adapter: std::vector{
using std::vector::vector;
// Adapter(std::initializer_list l)
// :std::vector::vector(l){}
};
template
Adapter(std::initializer_list) -> Adapter;

int main(){
Adapter x{1,2,3};
}

see https://compiler-explorer.com/z/hj9zPPa8d

defining the constructor instead of the (not yet inherited) deduction guide
makes it work.