https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69549
--- Comment #9 from jwjagersma at gmail dot com --- Created attachment 51840 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=51840&action=edit diagnostics This patch adds checks for: - Top-level AS-qualifiers on fields, local variables, function parameters and function return types. - Assignment of pointers and references to different address spaces. - Combining AS-qualifiers in template substitution. An appropriate error message is emitted in each case. Not detected: AS-qualifiers on non-type template parameters (but they are stripped and ignored, of course). I think this covers most invalid uses. Am I missing anything?