delorie.com/archives/browse.cgi | search |
Mailing-List: | contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm |
List-Subscribe: | <mailto:cygwin-subscribe AT sources DOT redhat DOT com> |
List-Archive: | <http://sources.redhat.com/ml/cygwin/> |
List-Post: | <mailto:cygwin AT sources DOT redhat DOT com> |
List-Help: | <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs> |
Sender: | cygwin-owner AT sources DOT redhat DOT com |
Delivered-To: | mailing list cygwin AT sources DOT redhat DOT com |
Message-ID: | <005d01c143a5$34f7bb80$6501a8c0@dns.rcn.net> |
Reply-To: | "Robert Allan Schwartz" <notbob AT tessellation DOT com> |
From: | "Robert Allan Schwartz" <notbob AT tessellation DOT com> |
To: | <cygwin AT cygwin DOT com> |
Subject: | 1.3.3: g++ misinterprets an instantiation of a template class |
Date: | Sat, 22 Sep 2001 16:28:51 -0400 |
Organization: | Tessellation Training |
MIME-Version: | 1.0 |
X-Priority: | 3 |
X-MSMail-Priority: | Normal |
X-Mailer: | Microsoft Outlook Express 5.50.4807.1700 |
X-MimeOLE: | Produced By Microsoft MimeOLE V5.50.4807.1700 |
Here is the test case: #include <iostream> using namespace std; // general case: template <bool /* unnamed */> class static_checker; // declaration, not definition. // special case: template <> class static_checker<true> { // definition. }; int main(void) { static_checker<sizeof(int) == 4> sizeof_int_checker; // line 20. static_checker<sizeof(char) == 4> sizeof_char_checker; // line 22. return 0; } I expect an error on line 22, as static_checker<false> is declared but not defined, but instead I get these errors: sample036.cpp: In function `int main()': sample036.cpp:20: `sizeof_int_checker' undeclared (first use this function) sample036.cpp:20: (Each undeclared identifier is reported only once sample036.cpp:20: for each function it appears in.) sample036.cpp:20: parse error before `;' sample036.cpp:22: `sizeof_char_checker' undeclared (first use this function) sample036.cpp:22: parse error before `;' MSVC 6.0 and Metrowerks CodeWarrior 2.0 get this right. Thanks for your help, Robert Schwartz -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |