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 <type_traits> template<typename R, typename D> struct unique_resource { template<typename RR, typename DD, typename = std::enable_if_t<true> > unique_resource(RR &&r, DD &&d) noexcept(true) {} template<typename MR, typename MD, typename S> friend auto make_unique_resource_checked(MR &&r, const S &invalid, MD &&d) noexcept(std::is_nothrow_constructible_v<std::decay_t<MR>,MR> && std::is_nothrow_constructible_v<std::decay_t<MD>,MD>) ; }; template<typename R, typename D> unique_resource(R, D) -> unique_resource<R, D>; template<typename R, typename D, typename S> [[nodiscard]] auto make_unique_resource_checked(R &&r, const S &invalid, D &&d) noexcept(std::is_nothrow_constructible_v<std::decay_t<R>,R> && std::is_nothrow_constructible_v<std::decay_t<D>,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<class MR, class MD, class S> auto make_unique_resource_checked(MR&&, const S&, MD&&)': ../src/gcc-ice-test.cpp:14:7: required from 'struct unique_resource<int, main()::<lambda()> >' ../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