[Bug c++/86692] New: Too lenient parsing of noptr-new-declarator
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86692 Bug ID: 86692 Summary: Too lenient parsing of noptr-new-declarator Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /*** BEGIN SOURCE ***/ int main() { int n = 1; auto p = new int[n][2, 3]; } / END SOURCE / This compiles without errors, but `2, 3` is not a constant-expression (conditional-expression) as required by the grammar production for noptr-new-declarator in [expr.new]. This leniency has some potential for confusion as someone could interpret `2, 3` as dimensions of a multi-dimensional array, rather than the comma operator. For comparison, clang correctly reports a syntax error here. Checked in build 9.0.0 20180725 (experimental)
[Bug c++/86717] New: Unexpected error in dynamic allocation of an array of function pointers
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86717 Bug ID: 86717 Summary: Unexpected error in dynamic allocation of an array of function pointers Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template void f() { typedef void(*arr[T::value])(); new arr; // OK new (void(*[(T::value)])()); // OK new (void(*[T::value])()); // error: capture of non-variable 'T' } struct S { static constexpr int value = 5; }; int main() { f(); } /*** END SOURCE ***/ The last new-expression is rejected (as I believe, incorrectly). For comparison, clang and MSVC compile this code successfully. Tested with build 9.0.0 20180726 (experimental).
[Bug c++/86728] New: [Regression] unexpected error: conversion from ', ...)>' to non-scalar type 'std::function' requested
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86728 Bug ID: 86728 Summary: [Regression] unexpected error: conversion from ', ...)>' to non-scalar type 'std::function' requested Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /*** BEGIN SOURCE ***/ #include std::function a = [](int x ...) { }; // OK std::function b = [](auto x, ...) { }; // OK std::function c = [](auto x ...) { }; /* error: conversion from ', ...)>' to non-scalar type 'std::function' requested */ / END SOURCE / The error in the last line appears with build 9.0.0 20180728 (experimental), 8.2, 8.1. This code used to compile successfully with GCC versions 6.1 - 7.3. For comparison, the latest versions of clang and MSVC compile this code successfully as well.
[Bug c++/86883] New: Unexpected error: expansion pattern '' contains no argument packs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86883 Bug ID: 86883 Summary: Unexpected error: expansion pattern '' contains no argument packs Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct A { template class Head, T... Args> static constexpr Head foo = { }; }; template struct C { static constexpr auto value = x; }; using type = decltype(A::foo); static_assert(type::value == 1); /*** END SOURCE ***/ The g++ 8.2.0 compiler rejects this code: /** BEGIN OUTPUT **/ :4:34: error: expansion pattern '' contains no argument packs static constexpr Head foo = { }; ^ /*** END OUTPUT ***/ I believe the code is correct and should be compiled successfully. For comparison, Clang accepts it.
[Bug c++/86915] New: Segmentation fault for an array of auto in template parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86915 Bug ID: 86915 Summary: Segmentation fault for an array of auto in template parameter Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct S; /*** END SOURCE ***/ ' Segmentation fault 1 | template struct S; | ^ Tested with 9.0.0 20180809 (experimental)
[Bug c++/86918] New: internal compiler error: unexpected expression 'v' of kind template_parm_index
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86918 Bug ID: 86918 Summary: internal compiler error: unexpected expression 'v' of kind template_parm_index Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct S { template struct X; }; template<> template struct S::X { static constexpr bool value = v; }; static_assert(S::X::value); /*** END SOURCE ***/ : In instantiation of 'struct S::X': :13:30: required from here :9:18: internal compiler error: unexpected expression 'v' of kind template_parm_index 9 | struct S::X { | ^
[Bug c++/86920] New: A matching template specialization is not selected
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86920 Bug ID: 86920 Summary: A matching template specialization is not selected Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct S { template struct X { static constexpr bool value = false; }; }; template<> template struct S::X { static constexpr bool value = true; }; static_assert(S::X::value); /*** END SOURCE ***/ EXPECTED: no errors ACTUAL: :15:15: error: static assertion failed 15 | static_assert(S::X::value); | ^~
[Bug c++/86926] New: [Regression] ICE for a recursive generic lambda
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86926 Bug ID: 86926 Summary: [Regression] ICE for a recursive generic lambda Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /* BEGIN SOURCE */ int main() { constexpr auto f = [](auto self, auto n) { if(n < 2) return n; return self(self, n - 1) + self(self, n - 2); }; constexpr auto fibonacci = [=](auto n) { return f(f, n); }; static_assert(fibonacci(7) == 13); } /** END SOURCE **/ Compile with -std=c++17. EXPECTED: no errors. ACTUAL: : In instantiation of 'main():: [with auto:3 = int]': :11:30: required from here :9:54: internal compiler error: in build_over_call, at cp/call.c:8214 9 | constexpr auto fibonacci = [=](auto n) { return f(f, n); }; | ~^~ Tested with build 9.0.0 20180810 (experimental), appears to be a regression from GCC 8.2. For comparison, the code also successfully compiles with Clang.
[Bug c++/86926] [Regression] ICE for a recursive generic lambda
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86926 --- Comment #1 from Vladimir Reshetnikov --- Note: the error disappears if the variable `f` is not declared `constexpr`.
[Bug c++/86956] New: Use of an alias template unexpectedly breaks compilation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86956 Bug ID: 86956 Summary: Use of an alias template unexpectedly breaks compilation Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct Outer { template struct Inner; template using Alias = Inner; }; template<> template struct Outer::Inner { static constexpr bool value = v; }; static_assert(Outer::Inner::value); // OK static_assert(Outer::Alias::value); // error /*** END SOURCE ***/ The first static_assert compiles OK, but the second results in unexpected errors: /** BEGIN OUTPUT **/ : In instantiation of 'struct Outer::Inner': :17:39: required from here :12:27: error: type/value mismatch at argument 1 in template parameter list for 'template > struct Outer::Inner< >' 12 | struct Outer::Inner { | ^ :12:27: note: expected a constant of type 'bool', got 'void' :12:27: error: type/value mismatch at argument 1 in template parameter list for 'Outer::Inner< >::Inner' :12:27: note: expected a constant of type 'bool', got 'void' :13:27: error: type/value mismatch at argument 1 in template parameter list for 'template > struct Outer::Inner< >' 13 | static constexpr bool value = v; | ^ :13:27: note: expected a constant of type 'bool', got 'void' :13:27: error: type/value mismatch at argument 1 in template parameter list for 'value' :13:27: note: expected a constant of type 'bool', got 'void' :17:41: error: 'value' is not a member of 'Outer::Alias' {aka 'Outer::Inner'} 17 | static_assert(Outer::Alias::value); // error | ^ Compiler returned: 1 /*** END OUTPUT ***/ The part "expected a constant of type 'bool', got 'void'" looks inexplicable; "Inner< >" is also difficult to decipher. The issue is discovered with build 9.0.0 20180813 (experimental), but appears to exist in earlier versions as well. For comparison, Clang compiles this code successfully.
[Bug c++/86958] New: ICE in finish_member_declaration when an alias template is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86958 Bug ID: 86958 Summary: ICE in finish_member_declaration when an alias template is used Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct Outer { template struct Inner; template using Alias = Inner; }; template<> template struct Outer::Inner { static constexpr bool value = v; }; static_assert(Outer::Inner::value == sizeof(bool)); // OK static_assert(Outer::Alias::value == sizeof(bool); // error /*** END SOURCE ***/ The first static_assert compiles OK, but the second results in an ICE: /** BEGIN OUTPUT **/ : In instantiation of 'struct Outer::Inner': :17:39: required from here :13:27: internal compiler error: in finish_member_declaration, at cp/semantics.c:3085 13 | static constexpr auto value = sizeof(T); | ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 /*** END OUTPUT ***/ This issue was found with build 9.0.0 20180813 (experimental), but appears to exist in earlier versions as well. For comparison, Clang compiles this code successfully.
[Bug c++/86958] ICE in finish_member_declaration when an alias template is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86958 --- Comment #1 from Vladimir Reshetnikov --- Sorry, there is a missing closing parenthesis in my code. The last line should look like this: static_assert(Outer::Alias::value == sizeof(bool)); // error
[Bug c++/86959] New: Use of a variadic alias template unexpectedly breaks compilation
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86959 Bug ID: 86959 Summary: Use of a variadic alias template unexpectedly breaks compilation Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /*** BEGIN SOURCE ***/ template struct Outer { template struct Inner; template using Alias = Inner; }; template<> template struct Outer::Inner { static constexpr auto value = sizeof...(T); }; static_assert(Outer::Inner::value == 1); // OK static_assert(Outer::Alias::value == 1); // error / END SOURCE / The first static_assert compiles OK, but the second results in unexpected errors: /*** BEGIN OUTPUT ***/ : In instantiation of 'struct Outer::Inner': :17:39: required from here :12:27: error: template argument 1 is invalid 12 | struct Outer::Inner { | ^ :12:27: error: template argument 1 is invalid :13:27: error: template argument 1 is invalid 13 | static constexpr auto value = sizeof...(T); | ^ :13:27: error: template argument 1 is invalid :17:41: error: 'value' is not a member of 'Outer::Alias' {aka 'Outer::Inner'} 17 | static_assert(Outer::Alias::value == 1); // error | ^ Compiler returned: 1 / END OUTPUT / The issue was discovered with build 9.0.0 20180813 (experimental), but appears to exist in earlier versions as well. For comparison, Clang compiles this code successfully. Might be related to Bug 86956 and Bug 86958.
[Bug c++/86918] internal compiler error: unexpected expression 'v' of kind template_parm_index
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86918 --- Comment #4 from Vladimir Reshetnikov --- I could not find a wording in the Standard that disallows this kind of specialization (although certainly I might have overlooked it). A similar code where the template parameter list is changed in a specialization compiles successfully with GCC: template struct Outer { template struct Inner; }; template<> template struct Outer::Inner { static constexpr auto value = sizeof...(x); }; static_assert(Outer::Inner<>::value == 0); // OK
[Bug c++/86960] New: [Regression] internal compiler error: in coerce_template_parms
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86960 Bug ID: 86960 Summary: [Regression] internal compiler error: in coerce_template_parms Product: gcc Version: 8.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct Outer { template struct Inner; }; template<> template struct Outer::Inner { static constexpr bool value = x; }; static_assert(Outer::Inner::value); /* internal compiler error: in coerce_template_parms, at cp/pt.c:8533 */ /*** END SOURCE ***/ Fails in GCC 8.1 and 8.2, compiles successfully with 7.3. Might be related to Bug 86918, Bug 86920, Bug 86956, Bug 86958.
[Bug c++/86958] ICE in finish_member_declaration when an alias template is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86958 --- Comment #4 from Vladimir Reshetnikov --- Apparently, I somehow pasted a wrong code into this bug report. If you wish, you can close this one, and I will file proper one(s).
[Bug c++/86961] New: ICE in finish_member_declaration when an alias template is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86961 Bug ID: 86961 Summary: ICE in finish_member_declaration when an alias template is used Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /** BEGIN SOURCE **/ template struct Outer { template struct Inner; template using Alias = Inner; }; template<> template struct Outer::Inner { static constexpr auto value = sizeof(T); }; static_assert(Outer::Inner::value == sizeof(bool)); // OK static_assert(Outer::Alias::value == sizeof(bool)); // error /*** END SOURCE ***/ The first static_assert compiles OK, but the second results in an ICE: /** BEGIN OUTPUT **/ : In instantiation of 'struct Outer::Inner': :17:39: required from here :13:27: internal compiler error: in finish_member_declaration, at cp/semantics.c:3085 13 | static constexpr auto value = sizeof(T); | ^ Compiler returned: 1 /*** END OUTPUT ***/ This issue was found with build 9.0.0 20180813 (experimental), but appears to exist in earlier versions as well. For comparison, Clang compiles this code successfully.
[Bug c++/86958] ICE in finish_member_declaration when an alias template is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86958 Vladimir Reshetnikov changed: What|Removed |Added Status|RESOLVED|CLOSED --- Comment #6 from Vladimir Reshetnikov --- I filed a corrected version as Bug 86961.
[Bug c++/86915] Segmentation fault for an array of auto in template parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86915 Vladimir Reshetnikov changed: What|Removed |Added Status|RESOLVED|VERIFIED --- Comment #4 from Vladimir Reshetnikov --- Verified.
[Bug c++/86728] [7/8/9 Regression] unexpected error: conversion from ', ...)>' to non-scalar type 'std::function' requested
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86728 Vladimir Reshetnikov changed: What|Removed |Added Status|RESOLVED|VERIFIED --- Comment #7 from Vladimir Reshetnikov --- Verified in 9.0.0 20180813 (experimental).
[Bug c++/84839] [6/7 Regression] ICE (Segmentation fault) when `decltype` is used with parameter pack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84839 Vladimir Reshetnikov changed: What|Removed |Added Status|RESOLVED|VERIFIED --- Comment #5 from Vladimir Reshetnikov --- Verified.
[Bug c++/84798] [6/7 Regression] ICE (Segmentation fault) if `auto` appears in a template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84798 Vladimir Reshetnikov changed: What|Removed |Added Status|RESOLVED|VERIFIED --- Comment #11 from Vladimir Reshetnikov --- Verified.
[Bug c++/84840] [6/7/8 Regression] ICE (in poplevel_class) for `auto` in alias declaration
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84840 Vladimir Reshetnikov changed: What|Removed |Added Status|RESOLVED|VERIFIED --- Comment #3 from Vladimir Reshetnikov --- Verified.
[Bug c++/86966] New: ICE (Segmentation fault) for an explicit specialization of a member class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86966 Bug ID: 86966 Summary: ICE (Segmentation fault) for an explicit specialization of a member class template Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /* SOURCE */ template struct S { template struct X { }; }; template<> template<> struct S<>::X { }; S<>::X<> x; /*** END SOURCE ***/ /* OUTPUT */ :11:8: internal compiler error: Segmentation fault 11 | S<>::X<> x; |^ Compiler returned: 1 /*** END OUTPUT ***/
[Bug c++/86966] ICE (Segmentation fault) for an explicit specialization of a member class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86966 --- Comment #2 from Vladimir Reshetnikov --- I believe the code is valid. We explicitly specialize the member class template X of S for S<> (i.e. the parameter pack T is empty). T is expanded into a list of zero non-type template parameters of S<>::X. Here is a similar code where we specialize for S, i.e. provide one template argument bool for the pack T: template struct S { template struct X { }; }; template<> template struct S::X { }; Here T is expanded into a list of one non-type template parameter of type bool. This code compiles successfully.
[Bug c++/86966] ICE (Segmentation fault) for an explicit specialization of a member class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86966 --- Comment #3 from Vladimir Reshetnikov --- Might be related to Bug 86960 and Bug 86918.
[Bug c++/86966] ICE (Segmentation fault) for an explicit specialization of a member class template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86966 --- Comment #4 from Vladimir Reshetnikov --- Also, might be related to Bug 84796.
[Bug c++/86960] [Regression] internal compiler error: in coerce_template_parms
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86960 --- Comment #2 from Vladimir Reshetnikov --- Also, might be related to Bug 84796 and Bug 86961.
[Bug c++/86961] ICE in finish_member_declaration when an alias template is used
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86961 --- Comment #1 from Vladimir Reshetnikov --- Might be related to Bug 86956 and Bug 86959.
[Bug c++/86969] New: [Regression] ICE (in tsubst_copy) for a generic recursive lambda
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86969 Bug ID: 86969 Summary: [Regression] ICE (in tsubst_copy) for a generic recursive lambda Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /* BEGIN SOURCE */ auto compose = [](auto... fs) { if constexpr (sizeof...(fs) == 0) { return [](auto x) { return x; }; } else { auto fn = [](auto self, auto f, auto... fs) { if constexpr (sizeof...(fs) == 0) return f; else return [=](auto x) { return f(self(self, fs...)(x)); }; }; return fn(fn, fs...); } }; static_assert(compose( [](auto x) { return x * 3; }, [](auto x) { return x + 1; }, [](auto x) { return x / 2; } )(6) == 12); /** END SOURCE **/ EXPECTED: no errors. ACTUAL: : In instantiation of ' [with auto:1 = {, , }]:: [with auto:3 = [with auto:1 = {, , }]::; auto:4 = ; auto:5 = {, }]': :11:18: required from ' [with auto:1 = {, , }]' :19:5: required from here :8:30: internal compiler error: in tsubst_copy, at cp/pt.c:15348 8 | return f(self(self, fs...)(x)); | ^ Compiles successfully with 7.3, fails with 8.1 and newer. Compiles successfully with Clang. Looks similar to Bug 86926, but ICE location is different.
[Bug c++/86986] New: Unexpected errors for template parameter pack in a template template parameter
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86986 Bug ID: 86986 Summary: Unexpected errors for template parameter pack in a template template parameter Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /* SOURCE */ template struct X { template class...> struct Y { }; }; using type = X::Y<>; /*** END SOURCE ***/ /* OUTPUT */ : In instantiation of 'struct X': :7:20: required from here :4:12: error: '' is not a valid type for a template non-type parameter 4 | struct Y { }; |^ :4:12: error: '' is not a valid type for a template non-type parameter :7:22: error: 'Y' in 'struct X' does not name a template type 7 | using type = X::Y<>; | ^ Compiler returned: 1 /*** END OUTPUT ***/ Clang compiles this code successfully
[Bug c++/87001] New: False error "expansion pattern 'x' contains no argument packs"
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87001 Bug ID: 87001 Summary: False error "expansion pattern 'x' contains no argument packs" Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /*** BEGIN SOURCE ***/ template struct X { template class U> struct Y { template using type = U; }; }; / END SOURCE / Or, without using the `typeof` extension, it can be written: /*** BEGIN SOURCE ***/ template struct X { template class U> struct Y { template using type = U; }; }; / END SOURCE / There is an unexpected error: :6:28: error: expansion pattern 'x' contains no parameter packs 6 | using type = U; |^ Compiler returned: 1 For comparison, it compiles fine with Clang.
[Bug c++/87012] New: [Regression] ICE in verify_unstripped_args_1
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87012 Bug ID: 87012 Summary: [Regression] ICE in verify_unstripped_args_1 Product: gcc Version: 9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- /* BEGIN SOURCE */ template using ref = T&; int x; template class T, T> struct X { }; struct Y : X { }; /** END SOURCE **/ : In instantiation of 'struct X': :9:12: required from here :7:10: internal compiler error: in verify_unstripped_args_1, at cp/pt.c:1155 7 | struct X { }; | ^ Compiler returned: 1 Compiles fine with GCC 8.2 and Clang.
[Bug c++/84796] New: ICE in a template parameter pack expansion
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84796 Bug ID: 84796 Summary: ICE in a template parameter pack expansion Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code causes an ICE in GCC 8.0.1 20180308 (tested with https://godbolt.org/): /* SOURCE */ template struct S { template static void f() { } }; int main(){ S::f<0>(); } /*** END SOURCE ***/ /* OUTPUT */ : In function 'int main()': :8:18: internal compiler error: tree check: accessed elt 1 of tree_vec with 0 elts in tsubst_pack_expansion, at cp/pt.c:11743 S::f<0>(); ^ mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 /*** END OUTPUT ***/ Looks like a regression: no ICE occurs with GCC 7.3, but the code is rejected with an error (I believe, incorrectly): /* OUTPUT */ : In function 'int main()': :8:18: error: no matching function for call to 'S::f<0>()' S::f<0>(); ^ :4:17: note: candidate: template static void S::f() [with T ...n = {n ...}; T = {int}] static void f() { } ^ :4:17: note: template argument deduction/substitution failed: Compiler returned: 1 /*** END OUTPUT ***/
[Bug c++/84798] New: ICE (Segmentation fault) if `auto` appears in a template argument
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84798 Bug ID: 84798 Summary: ICE (Segmentation fault) if `auto` appears in a template argument Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code causes an ICE in GCC 8.0.1 20180308 (tested with https://godbolt.org/): /** SOURCE **/ template struct S { static constexpr T value = 0; }; constexpr auto x = S::value; / END SOURCE / /** OUTPUT **/ :6:38: internal compiler error: Segmentation fault constexpr auto x = S::value; ^ mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 / END OUTPUT / The same problem appears to exist in all versions since GCC 6.1.
[Bug c++/84839] New: ICE (Segmentation fault) when `decltype` is used with parameter pack
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84839 Bug ID: 84839 Summary: ICE (Segmentation fault) when `decltype` is used with parameter pack Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code causes an ICE in GCC 8.0.1 20180312 (tested with https://godbolt.org/): /* SOURCE */ template struct S { using fptr = void(*)(T... x, decltype(x)... y); }; using F = S::fptr; /*** END SOURCE ***/ /* OUTPUT */ g++: internal compiler error: Segmentation fault signal terminated program cc1plus Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 4 /*** END OUTPUT ***/
[Bug c++/84840] New: ICE (in poplevel_class) for `auto` in alias declaration
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84840 Bug ID: 84840 Summary: ICE (in poplevel_class) for `auto` in alias declaration Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code causes an ICE in GCC 8.0.1 20180312 (tested with https://godbolt.org/): /* SOURCE */ struct S { using type = void(auto); }; /*** END SOURCE ***/ /* OUTPUT */ :3:1: internal compiler error: in poplevel_class, at cp/name-lookup.c:4423 }; ^ mmap: Invalid argument Please submit a full bug report, with preprocessed source if appropriate. See <https://gcc.gnu.org/bugs/> for instructions. Compiler returned: 1 /*** END OUTPUT ***/
[Bug c++/84857] New: A valid call to a template function in a variadic template struct is rejected
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84857 Bug ID: 84857 Summary: A valid call to a template function in a variadic template struct is rejected Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code is rejected by GCC 8.0.1 20180313 (tested with https://godbolt.org/): /* SOURCE */ template struct S { template static int f() { return 0; } }; int t = S::f<0, 0>(); /*** END SOURCE ***/ /* OUTPUT */ :9:30: error: no matching function for call to 'S::f<0, 0>()' int t = S::f<0, 0>(); ^ :4:16: note: candidate: 'template static int S::f() [with T ...xs = {xs ...}; T = {int, int}]' static int f() { ^ :4:16: note: template argument deduction/substitution failed: :9:30: error: wrong number of template arguments (2, should be 1) int t = S::f<0, 0>(); ^ Compiler returned: 1 /*** END OUTPUT ***/ I believe this code is correct and should be accepted.
[Bug c++/84893] New: Rejects a valid code with variadic function template taking a function pointer
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84893 Bug ID: 84893 Summary: Rejects a valid code with variadic function template taking a function pointer Product: gcc Version: 8.0.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: v.reshetnikov at gmail dot com Target Milestone: --- The following C++ code is rejected by GCC 8.0.1 20180313 (tested with https://godbolt.org/): /* SOURCE */ template void f(void(*)(T..., int)) { } void g(bool, int) { } int main() { f(g); } /*** END SOURCE ***/ /* OUTPUT */ : In function 'int main()': :7:14: error: no matching function for call to 'f(void (&)(bool, int))' f(g); ^ :2:6: note: candidate: 'template void f(void (*)(T ..., int))' void f(void(*)(T..., int)) { } ^ :2:6: note: template argument deduction/substitution failed: :7:14: note: mismatched types 'int' and 'bool' f(g); ^ Compiler returned: 1 /*** END OUTPUT ***/ I believe the code is valid and should be compiled successfully.