[Bug c++/98283] decltype(auto) may deduce a static data member to wrong type in a template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98283 Patrick Palka changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED Target Milestone|--- |14.0 CC||ppalka at gcc dot gnu.org Assignee|unassigned at gcc dot gnu.org |ppalka at gcc dot gnu.org --- Comment #3 from Patrick Palka --- Fixed for GCC 14, thanks for the bug report
[Bug c++/98283] decltype(auto) may deduce a static data member to wrong type in a template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98283 --- Comment #2 from CVS Commits --- The master branch has been updated by Patrick Palka : https://gcc.gnu.org/g:e4f1ea5d8b96fc9fbe4fc0e0e0a4938ceeef092f commit r14-560-ge4f1ea5d8b96fc9fbe4fc0e0e0a4938ceeef092f Author: Patrick Palka Date: Sun May 7 11:57:22 2023 -0400 c++: parenthesized -> resolving to static data member [PR98283] Here we're neglecting to propagate parenthesized-ness when the member access (this->m) resolves to a static data member (and thus finish_class_member_access_expr yields a VAR_DECL instead of a COMPONENT_REF). PR c++/98283 gcc/cp/ChangeLog: * pt.cc (tsubst_copy_and_build) : Propagate REF_PARENTHESIZED_P more generally via force_paren_expr. * semantics.cc (force_paren_expr): Document default argument. gcc/testsuite/ChangeLog: * g++.dg/cpp1y/paren6.C: New test.
[Bug c++/98283] decltype(auto) may deduce a static data member to wrong type in a template
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98283 Andrew Pinski changed: What|Removed |Added Status|UNCONFIRMED |NEW Ever confirmed|0 |1 Keywords||accepts-invalid Last reconfirmed||2021-08-03 Summary|decltype(auto) may deduce a |decltype(auto) may deduce a |static data member to wrong |static data member to wrong |type|type in a template --- Comment #1 from Andrew Pinski --- Reduced testcase that is accepted but should not be: struct TestSkip { static int unused; }; template struct FIELD { TestSkip *obj; decltype(auto) value() { return (obj->unused); } }; int main() { TestSkip s; int sf; int i; decltype((FIELD().value())) b; } Confirmed.