// { dg-additional-options "-fmodules-ts" } import M; int main() { // These are all OK function(); int a = var; klass k; klass_tmpl kt; klass_tmpl ktp; no_odr_use(); function_tmpl(); function_tmpl(); int b = var_tmpl; int c = var_tmpl; int d = *ptr; int e = dynamic_var; // But don't ignore exposures in these cases function_tmpl(); // { dg-message "required from here" } int x = var_tmpl; // { dg-message "required from here" } int y = var_tmpl; // { dg-message "required from here" } int z = *ptr_tmpl; // { dg-message "required from here" } // And decls initialized to a TU-local value are not constant here // Unfortunately the error does not currently point to this decl constexpr int& r = constant_ref; // { dg-error "is not a constant expression" "" { target *-*-* } 0 } } // The errors occur in a different file, so we just test that all the // needed "required from here"s are found above. // { dg-error "instantiation exposes TU-local entity" "" { target *-*-* } 0 } // { dg-bogus "required from here" "" { target *-*-* } 0 }