http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49418
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org --- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-06-21 13:32:06 UTC --- The problem seems to be that x has T const type before instantiation, but int (without const) after instantiation. The spot where the const is lost is: type = type_decays_to (type); TREE_TYPE (r) = type; cp_apply_type_quals_to_decl (cp_type_quals (type), r); Does C++ really mandate stripping the toplevel qualifiers from the PARM_DECLs here? It isn't stripped from VAR_DECLs. OpenMP 2.5/OpenMP 3.0 says that const qualified parameters and variables are predetermined shared. While it hopefully changes in some way in OpenMP 3.1 (though, the current 3.1 draft wording is likely to change, as it is backwards incompatible with default(none)), for older standards the presence/lack of const makes a big difference.