Commit Graph

3 Commits

Author SHA1 Message Date
William S Fulton b78dba177a Inherit constructors named through a typedef base
C++11 inheriting constructors (using Base::Base;) now work when the immediate
base class is named through a typedef, a chain of typedefs, a typedef whose
template argument is itself a typedef, a scope-qualified or namespaced name, or
a type-template parameter used directly as the base class (the mixin idiom).

The inheriting constructor's using-declaration qualifier is normalized in the
typepass stage; the inheriting base is then found by identity in the resolved base
class list and the base class' constructors are used to implement the inherited
constructors.

An inheriting-constructor using declaration whose qualifier is not an immediate
base class is reported with Warning 329 (uses base '...' which is not an
immediate base of '...') rather than the generic Warning 315.

Closes #2951)

Assisted-by: Claude Opus 4.8
2026-06-17 01:47:06 +01:00
William S Fulton 978f675ad7 Fix spurious Warning 315 for a member using-declaration through a typedef base with a constructor
When a base class declares a constructor of its own, the constructor shares the
base class name.  Resolving a typedef that names the base to its scope looked the
base class name up through the derived class' inherited scope and found the base
constructor ahead of the class itself, so no typedef scope alias was created and a
later 'using base_type::member;' was reported as Warning 315 and the member
silently dropped.

Skip constructor nodes (including the using-declaration nodes that inherit base
constructors, which also carry the class name) when resolving a typedef to its
scope, so the class node is found instead.

Resolving the typedef now goes through Swig_symbol_clookup_check, whose
using-declaration chase loop was missing the self-reference guard that
Swig_symbol_clookup already has.  Add it to avoid infinite recursion (a stack
overflow and crash) on a self-referential using declaration; the existing test
Examples/test-suite/using2.i, with a top-level 'using ::baz;', exercises this.

Assisted-by: Claude Opus 4.8 (1M context)
2026-06-17 01:47:06 +01:00
Erez Geva a1b3ca81ca More Lua tests (#3405)
- Add Lua examples
- Add and fix unused Lua tests
- Add lua_module_global complementary test of lua_no_module_global
- Add Lua test-suite runme files

Enable friends_nested and minherit inline test code for Lua via the
SWIGLUA guards.
2026-05-31 15:09:53 +01:00