[Bug c++/56377] New: [4.8 Regression] template args in substitution-failure diagnostics
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56377 Bug #: 56377 Summary: [4.8 Regression] template args in substitution-failure diagnostics Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: minor Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: pl.smith.m...@gmail.com When a candidate function for which substituion failed is listed in a diagnostic, if the failure stems from a template parameter that have an explicit argument, the explicit arguments are listed as . For example: template typename T::type f(); int main () { f(); } Produces (4.8, no flags): test.cpp: In function ג€˜int main()ג€™: test.cpp:5:10: error: no matching function for call to 'f()' f(); ^ test.cpp:5:10: note: candidate is: test.cpp:2:18: note: template typename T::type f() typename T::type f(); ^ test.cpp:2:18: note: template argument deduction/substitution failed: * test.cpp: In substitution of 'template typename T::type f() [with T = ]': * test.cpp:5:10: required from here test.cpp:2:18: error: 'int' is not a class, struct, or union type In 4.7 it is "[with T = int]".
[Bug c++/56377] [4.8 Regression] template args in substitution-failure diagnostics
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56377 --- Comment #1 from Paul Smith 2013-02-18 16:12:00 UTC --- Looks like this was introduced in rev. 190664, with the merging of 'deduction_tsubst_fntype' into 'fn_type_unification'. The instantiation context is constructed with 'targs' as the vector of template arguments, which is still empty when substituting the explicit arguments into the function type the first time. This can be fixed by either constructing the instantiation context using 'explicit_targs' when non-null, or by copying 'explicit_targs' into 'targs' before the substitution.
[Bug c++/56380] New: Const/reference mutable members are not always rejected in class templates
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56380 Bug #: 56380 Summary: Const/reference mutable members are not always rejected in class templates Classification: Unclassified Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassig...@gcc.gnu.org ReportedBy: pl.smith.m...@gmail.com GCC (all versions?) accepts mutable members of const-qualified/reference type in class templates, if the const-ness/reference-ness is introduced during instantiation: template struct X { X(); mutable T x; }; X a; // no error X b; // no error
[Bug c++/56377] [4.8 Regression] template args in substitution-failure diagnostics
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56377 Paul Smith changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|FIXED | --- Comment #5 from Paul Smith 2013-02-23 15:15:47 UTC --- There can still be arguments before the substitution: template void f() { f(); } int main() { f<0>(); } Output: test.cpp:3:11: error: template instantiation depth exceeds maximum of 900 (use -ftemplate-depth= to increase the maximum) substituting ‘template void f() [with int N = ]’ f(); ^ ...