From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id CB5F53942001; Mon, 5 Oct 2020 16:12:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB5F53942001 From: "tobias.weinzierl at durham dot ac.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/96835] Constructor in offload template class Date: Mon, 05 Oct 2020 16:12:48 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: tobias.weinzierl at durham dot ac.uk X-Bugzilla-Status: WAITING X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Oct 2020 16:12:48 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D96835 --- Comment #2 from Tobias Weinzierl = --- #include #pragma omp declare target template struct vector { int values_[sz]; vector(); vector(int const& init_val); int dot(vector o) { int res =3D 0; for (int i =3D 0; i < sz; ++ i) res +=3D values_[i] * o.values_[i]; return res; } }; template vector::vector(int const& init_val) { for (int i =3D 0; i < sz; ++ i) values_[i] =3D init_val; } template vector::vector() : vector(0) { } #pragma omp end declare target int main() { int res; #pragma omp target map(from:res) { vector<4> v1(1); vector<4> v2(2); res =3D v1.dot(v2); } printf("%d\n", res); return 0; }=