On this page
B0105: operator from another language
Catalog status: active. Default severity: error. Stable name: foreign-operator. Family: Syntax and source text.
==, !=, && and || come from C-family languages. Ada writes them =, /=, and then and or else. Verada reads the intended Ada operator and carries on.
Example (Vada)
if A == B && C != D thenExample (Varc)
if a == b && c /= d {
What to do (Vada)
if A = B and then C /= D thenNote that and then and or else cannot be mixed without parentheses in Ada (B0109).
What to do (Varc)
if a == b && c != d {
In Varc = assigns and /= divides and assigns, so neither can compare. Note that && and || cannot be mixed without parentheses (B0109).
For a bounded range such as 1..8, use 1...8 or 1..=8 to include 8, or 1..<8 to exclude it. All three forms include 1.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See syntax and source text, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.