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