Skip to content

[cpyrt] Stop the using-directive search at a cycle - #169

Open
conrade-ctc wants to merge 1 commit into
compiler-research:mainfrom
chicagotrading:upstreaming/using-directive-cycle
Open

conrade-ctc wants to merge 1 commit into
compiler-research:mainfrom
chicagotrading:upstreaming/using-directive-cycle

Conversation

@conrade-ctc

Copy link
Copy Markdown
Contributor

Mutual using-directives are valid C++: [namespace.qual]/3 (Example 3) searches each namespace at most once. Clang and GCC accept this code:

namespace a {}
namespace p { using namespace a; int x = 1; }
namespace a { using namespace p; int y = 2; }

In cppjit, the lookup of a name that neither namespace has (cppjit.gbl.a.nothere) recursed between a and p until the stack overflowed. The attribute lookup now searches each namespace at most once per lookup.

test32_using_directive_cycle covers names found through the cycle and a missing name.

🤖 Done with the help of Claude Code (Opus 5.5, human in the loop)

Mutual using-directives are valid C++ ([namespace.qual]/3). The attribute
lookup recursed through them until the stack overflowed. Search each
namespace at most once for each lookup.

Co-developed-with-the-help-of: Claude Code (Opus 5.5, human in the loop)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant