Opened 4 months ago

Closed 4 months ago

#237 closed defect (fixed)

Various container includes cannot be in the same compile unit

Reported by: mlbrooks Owned by: Michael Brooks <mlbrooks@…>
Priority: minor Component: libcfa
Version: 1.0 Keywords:


Known inconsistencies:

  • Vector with bits/Containers
  • Vector with bits/Sequence

Minimal case

#include <vector.hfa>
#include <bits/sequence.hfa>

Expected: compile succeeds; link fails (no main)
Actual: compile fails: Cannot choose between 2 alternatives for back = 0p in ?{}( Sequable & ), where back is ambiguous between datum sq.back (intended) and function declared in vector.hfa (unintended).

Applied case

#include <vector.hfa>             // as in tests/
#include <bits/weakso_locks.hfa>  // represents desire to add this include in fstream.hfa
#include <fstream.hfa>            // as in tests/

(Behaviours are similar)

These prevent Fstream from including Locks (which includes both the above bits) because the Vector test includes Fstream, which produces the problem combination.

Problem comes from bits/x shipping function bodies that declare and refer to the names front/back. When included in a clean context, those names resolve as intended. When included in a context that already has Vector, those names conflict with declarations from Vector, making the lookups ambiguous. The uses that suffer from the ambiguity have assignment/comparison with very generic other arguments, e.g. front != 0p.

Change History (1)

comment:1 Changed 4 months ago by Michael Brooks <mlbrooks@…>

Owner: set to Michael Brooks <mlbrooks@…>
Resolution: fixed
Status: newclosed

In d0502a3:

Fixing function bodies in bits/containers and bits/sequence so they can coexist with declarations in vector Fixes #237?

libcfa/src/bits/* the fixes
libcfa/src/fstream.hfa adding the desired include, which wasn't possible under #237
tests/includes/* adding tests for these problematic combinations

Note: See TracTickets for help on using tickets.