aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2023-12-14 12:01:21 -0500
committerMarek Polacek <polacek@redhat.com>2023-12-14 16:39:51 -0500
commit1ae71269890f532a2bb06b84fc49f474c16e230d (patch)
tree9d1df936d0e0e4cb7e8fda0cf148dc8cbb16d5db /gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c
parent5fa27d9f8c4bec65887654e374146926d76690b0 (diff)
downloadgcc-1ae71269890f532a2bb06b84fc49f474c16e230d.zip
gcc-1ae71269890f532a2bb06b84fc49f474c16e230d.tar.gz
gcc-1ae71269890f532a2bb06b84fc49f474c16e230d.tar.bz2
c++: fix parsing with auto(x) at block scope [PR112482]
This is sort of like r14-5514, but at block scope. Consider struct A { A(int, int); }; void g (int a) { A bar(auto(a), 42); // not a fn decl } where we emit error: 'auto' parameter not permitted in this context which is bogus -- bar doesn't declare a function, so the auto is OK, but we don't know it till we've seen the second argument. The error comes from grokdeclarator invoked just after we've parsed the auto(a). A possible approach seems to be to delay the auto parameter checking and only check once we know we are indeed dealing with a function declaration. For tparms, we should still emit the error right away. PR c++/112482 gcc/cp/ChangeLog: * decl.cc (grokdeclarator): Do not issue the auto parameter error while tentatively parsing a function parameter. * parser.cc (cp_parser_parameter_declaration_clause): Check it here. gcc/testsuite/ChangeLog: * g++.dg/cpp23/auto-fncast15.C: New test.
Diffstat (limited to 'gcc/testsuite/gcc.dg/analyzer/use-after-free-2.c')
0 files changed, 0 insertions, 0 deletions