@@ -181,4 +181,39 @@ set -e
181181[ " $rc " -ne 0 ] || { cat unknown/s.log; echo " FAIL: --strict did not turn the warning into an error" ; exit 1; }
182182echo " ok --strict makes it an error"
183183
184+ # ── (4) a layer predicate cannot select dependencies, and says so ───────────
185+ #
186+ # A layer is resolved FROM the dependency graph, so a dependency chosen by one
187+ # would decide the answer it is asking for — docs/14 states the limit. The limit
188+ # is not the interesting part; being told about it is. By the time the layer
189+ # pass runs, dependency resolution is over, so such a section would otherwise be
190+ # dropped in exactly the silence this whole test exists to end.
191+ #
192+ # ⚠️ AND THE BUILD INPUTS UNDER THE SAME PREDICATE MUST STILL APPLY. A warning
193+ # that quietly disabled the rest of the section would trade one silent drop for
194+ # another.
195+ mkdir -p depcond/src
196+ cat > depcond/mcpp.toml << EOF
197+ [package]
198+ name = "depcond"
199+ version = "0.1.0"
200+
201+ [target.'cfg(c-abi = "$NOTCABI ")'.dependencies]
202+ never-resolved = "1.0.0"
203+
204+ [target.'cfg(c-abi = "$CABI ")'.build]
205+ defines = ["INPUTS_STILL_APPLY=1"]
206+ EOF
207+ cat > depcond/src/main.cpp << 'EOF '
208+ #ifndef INPUTS_STILL_APPLY
209+ #error "the warning about dependencies also suppressed the build inputs"
210+ #endif
211+ int main() { return 0; }
212+ EOF
213+ ( cd depcond && " $MCPP " build > d.log 2>&1 ) || {
214+ cat depcond/d.log; echo " FAIL: a layer-conditioned dependency must warn, not fail" ; exit 1; }
215+ grep -q " conditions dependencies on a target-side layer" depcond/d.log || {
216+ cat depcond/d.log; echo " FAIL: no diagnostic for a layer-conditioned dependency" ; exit 1; }
217+ echo " ok a layer-conditioned dependency is reported, and the build inputs still apply"
218+
184219echo " PASS: 328 layer predicates apply, and unknown ones say so"
0 commit comments