You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[OpenACC][Sema] Implement warning for non-effective 'private' (#149004)
A 'private' variable reference needs to have a default constructor and a
destructor, else we cannot properly emit them in codegen. This patch
adds a warning-as-default-error to diagnose this.
We'll have to do something similar for firstprivate/reduction, however
it isn't clear whether we could skip the check for default-constructor
for those two (they still need a destructor!). Depending on how we
intend to create them (and we probably have to figure this out?), we
could either require JUST a copy-constructor (then make the init section
just the alloca, and the copy-ctor be the 'copy' section), OR they
require a default-constructor + copy-assignment.
// expected-error@+1{{variable of type 'ImplDeletedCtor' referenced in OpenACC 'private' clause does not have a default constructor; reference has no effect}}
47
+
#pragma acc parallel private(IDC)
48
+
;
49
+
50
+
#pragma acc parallel private(DefC)
51
+
;
52
+
53
+
#pragma acc parallel private(IC)
54
+
;
55
+
56
+
// expected-error@+1{{variable of type 'DeletedCtor' referenced in OpenACC 'private' clause does not have a default constructor; reference has no effect}}
57
+
#pragma acc parallel private(DelC)
58
+
;
59
+
60
+
#pragma acc parallel private(ID)
61
+
;
62
+
63
+
#pragma acc parallel private(DefD)
64
+
;
65
+
66
+
// expected-error@+1{{variable of type 'DeletedDtor' referenced in OpenACC 'private' clause does not have a destructor; reference has no effect}}
67
+
#pragma acc parallel private(DelD)
68
+
;
69
+
70
+
// expected-error@+1{{variable of type 'ImplicitDelDtor' referenced in OpenACC 'private' clause does not have a destructor; reference has no effect}}
// expected-error@#PRIV{{variable of type 'ImplDeletedCtor' referenced in OpenACC 'private' clause does not have a default constructor; reference has no effect}}
88
+
// expected-note@+1{{in instantiation}}
89
+
private_templ(IDC);
90
+
private_templ(DefC);
91
+
private_templ(IC);
92
+
// expected-error@#PRIV{{variable of type 'DeletedCtor' referenced in OpenACC 'private' clause does not have a default constructor; reference has no effect}}
93
+
// expected-note@+1{{in instantiation}}
94
+
private_templ(DelC);
95
+
private_templ(ID);
96
+
private_templ(DefD);
97
+
// expected-error@#PRIV{{variable of type 'DeletedDtor' referenced in OpenACC 'private' clause does not have a destructor; reference has no effect}}
98
+
// expected-note@+1{{in instantiation}}
99
+
private_templ(DelD);
100
+
// expected-error@#PRIV{{variable of type 'ImplicitDelDtor' referenced in OpenACC 'private' clause does not have a destructor; reference has no effect}}
0 commit comments