Opened 4 years ago
Closed 4 years ago
#237 closed defect (fixed)
Various container includes cannot be in the same compile unit
Reported by: | mlbrooks | Owned by: | |
---|---|---|---|
Priority: | minor | Component: | libcfa |
Version: | 1.0 | Keywords: | |
Cc: |
Description ¶
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/vector.cfa #include <bits/weakso_locks.hfa> // represents desire to add this include in fstream.hfa #include <fstream.hfa> // as in tests/vector.cfa
(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 years ago by
Owner: | set to Michael Brooks <mlbrooks@…> |
---|---|
Resolution: | → fixed |
Status: | new → closed |
In d0502a3: