c++syntaxfunction-qualifier

Can you have "const const" after the function name?


I am investigating a block of code (that I did not write) that looks like:

customType foo::bar(void) const const {
    // baz
}

As far as I understand, the const const should really just be const. I can't find any reference to a valid usage of const that has two const keywords after the function name declaration.

Am I missing some valid, esoteric use of const here? This seems invalid to me.


Solution

  • It's just a typo. There are no use cases that I know of for double const, so the usage of it twice is likely a programming error.