From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14471 invoked by alias); 7 Jul 2014 15:51:03 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 14422 invoked by uid 48); 7 Jul 2014 15:50:57 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/61732] Derivation from final class incorrectly allowed Date: Mon, 07 Jul 2014 15:51:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED 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-SW-Source: 2014-07/txt/msg00385.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D61732 --- Comment #3 from Jonathan Wakely --- (In reply to Joaqu=C3=ADn M L=C3=B3pez Mu=C3=B1oz from comment #2) > Umm... This is not how I read [class]/3 (no mention to instances there). That refers to classes. in Your original example derived is not a class, it= 's a class template. It becomes a class when instantiated, but you never instant= iate it. > And, moreover, if your interpretation was right then the following should > compile too: >=20 > struct X final{}; >=20 > struct derived:X{}; >=20 > void foo(derived*){} >=20 > int main() > { > foo(0); > } >=20 > but GCC, here, does complain that derived can't derive from X. But there are no templates to be instantiated there. The definition of deri= ved is ill-formed, period. In your original example the definition of derived is only ill-formed if the base class is final, and base classes are only checked when the template is instantiated (because there could be an explicit specialization later in the translation unit that doesn't derive from the template argument, making derived well-formed). [temp.arg]/6 "If the use of a template-argument gives rise to an ill-formed construct in the instantiation of a template specialization, the program is ill-formed." N.B. "in the instantiation" not earlier. [temp.inst] says when the point of instantiation is, and your program doesn't instantiate derived. FWIW clang and EDG accept your first example too. >>From gcc-bugs-return-455795-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Mon Jul 07 15:59:25 2014 Return-Path: Delivered-To: listarch-gcc-bugs@gcc.gnu.org Received: (qmail 30412 invoked by alias); 7 Jul 2014 15:59:24 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Delivered-To: mailing list gcc-bugs@gcc.gnu.org Received: (qmail 30287 invoked by uid 48); 7 Jul 2014 15:59:18 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/61735] basic_string bug when type_size is char. Date: Mon, 07 Jul 2014 15:59:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 4.8.2 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: WAITING 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: bug_status cf_reconfirmed_on everconfirmed Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg00386.txt.bz2 Content-length: 598 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61735 Jonathan Wakely changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |WAITING Last reconfirmed| |2014-07-07 Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely --- Please provide the information requested at http://gcc.gnu.org/bugs not just a link to a stackoverflow question without code.