As you may have read in different reports and so on, “mental illness” is not a standard clinical term. The standard clinical term is “mental disorder”, and that includes everything that's in our classification scheme. The one we use in Canada the most is the DSM-5, published by the American Psychiatric Association.
Dementia, which is actually classified as “major neurocognitive disorder”, is always the result of some other condition. If “mental disorder” were to be excluded, then “major neurocognitive disorder”—i.e., dementia—would also be excluded, because it is considered a diagnosable mental disorder.
