Commit e1ca2f5
committed
[clang][Parser] Allow private type aliases in out-of-line member function return types
Bug: In clang-repl (incremental parsing mode), out-of-line member
function definitions that use private/protected type aliases in their
return type incorrectly fail with access errors (e.g.,
io_context::impl_type *io_context::foo() errors with "'impl_type' is a
private member of 'io_context'"). This happens because the
disambiguation logic in isCXXDeclarationStatement calls
isCXXSimpleDeclaration, which triggers access checking before the
parser establishes the correct declaration context.
Fix: Extend the heuristic in ParseTentative.cpp that skips
isCXXSimpleDeclaration to also recognize pointer/reference
patterns (A::B *id, A::B &id, A::B &&id, A::B **id) as likely
declarations, avoiding the premature access check.1 parent 6f7ea34 commit e1ca2f5
File tree
2 files changed
+54
-1
lines changed- clang
- lib/Parse
- test/Interpreter
2 files changed
+54
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
65 | 71 | | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
66 | 84 | | |
67 | 85 | | |
68 | 86 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
0 commit comments