The following appears in OpenMP 3.1 sec. 2.9.1.1 as a predetermined
data-sharing attribute:
Variables with const-qualified type having no mutable member are
shared.
It does not appear in OpenmP 4.0, 4.5, or 5.0. This patch removes the
implementation of that attribute when the requested OpenMP version is
greater than 3.1.
One effect of that removal is that default(none) affects const
variables without mutable members.
Also, without this patch, if a const variable without mutable members
was explicitly lastprivate or private, it was an error because it was
predetermined shared. Now, clang instead complains that it's const
without mutable fields, which is a more intelligible diagnostic. That
should be fine for all of the above versions because they all have
something like the following, which is quoted from OpenMP 5.0
sec. 2.19.3:
A variable that is privatized must not have a const-qualified type
unless it is of class type with a mutable member. This restriction does
not apply to the firstprivate clause.
reduction and linear clauses already have separate checks for const
variables. Future patches will merge the implementations.
I would say it is better to outlined check as a standalone function rather than use checkConstNotMutableType for this purpose