aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/lambda.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2020-09-19 16:17:42 -0400
committerMarek Polacek <polacek@redhat.com>2020-09-21 17:48:11 -0400
commit7029dfa38b663d20e0de40395fcd45a2845e2f71 (patch)
tree8e17199e922c860dc4b9227e1a01b94d56e4a8c9 /gcc/cp/lambda.c
parent68402af1c68301c6bc852ddba6c63966ed706178 (diff)
downloadgcc-7029dfa38b663d20e0de40395fcd45a2845e2f71.zip
gcc-7029dfa38b663d20e0de40395fcd45a2845e2f71.tar.gz
gcc-7029dfa38b663d20e0de40395fcd45a2845e2f71.tar.bz2
c++: Implement -Wctad-maybe-unsupported.
I noticed that clang++ has this CTAD warning and thought that it might be useful to have it. From clang++: "Some style guides want to allow using CTAD only on types that "opt-in"; i.e. on types that are designed to support it and not just types that *happen* to work with it." So this warning warns when CTAD deduced a type, but the type does not define any deduction guides. In that case CTAD worked only because the compiler synthesized the implicit deduction guides. That might not be intended. It can be suppressed by adding a deduction guide that will never be considered: struct allow_ctad_t; template <typename T> struct S { S(T) {} }; S(allow_ctad_t) -> S<void>; This warning is off by default. It doesn't warn when the type comes from a system header unless -Wsystem-headers. gcc/c-family/ChangeLog: * c.opt (Wctad-maybe-unsupported): New option. gcc/cp/ChangeLog: * pt.c (deduction_guides_for): Add a bool parameter. Set it. (do_class_deduction): Warn when CTAD succeeds but the type doesn't have any explicit deduction guides. gcc/ChangeLog: * doc/invoke.texi: Document -Wctad-maybe-unsupported. gcc/testsuite/ChangeLog: * g++.dg/warn/Wctad-maybe-unsupported.C: New test. * g++.dg/warn/Wctad-maybe-unsupported2.C: New test. * g++.dg/warn/Wctad-maybe-unsupported3.C: New test. * g++.dg/warn/Wctad-maybe-unsupported.h: New file.
Diffstat (limited to 'gcc/cp/lambda.c')
0 files changed, 0 insertions, 0 deletions