Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
C++BuilderX
Compiler
Front end
bcc32
bitfields
diagnostics
exception handling
inline assembly
invocation
language
mangling scheme
namespaces
pragmas
pre-compiled headers
preprocessor
RTTI
templates
You are not logged in.
Help
Print
Public Report
Report From:
C++BuilderX/Compiler/Front end/bcc32/templates
[ Add a report in this area ]
Report #:
14110
Status:
Open
specializing variables fails
Project:
C++BuilderX/BC++ 2005
Build #:
1.8.0.328
Version:
1.5
Submitted By:
Thomas Neumann
Report Type:
Basic functionality failure
Date Reported:
7/3/2005 8:17:11 AM
Severity:
Infrequently encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
240033
Resolution:
None
(Resolution Comments)
Resolved in Build:
:
None
Duplicate of:
None
Voting and Rating
Overall Rating:
(1 Total Rating)
5.00 out of 5
Total Votes:
3
Description
Specializing a variable inside a template class fails when providing two specializations (for different template parameters). Specializing once works. See steps for an example.
Steps to Reproduce:
Compile the following program with bcc32 test.cpp:
struct A {
const A* a;
};
template <const char* c> struct B {
static const A b;
};
extern const char c[1]="";
extern const char d[1]="";
//I found out that the standard requires a declaration of the specialization before usage,
//so the following two lines:
template<> const A B<c>::b;
template<> const A B<d>::b;
//have to inserted before the last two lines.
//However bcc32 accepts the code neither with nor without declaration.
//Gcc accepts both versions, Comeau and icc require the declaration and
//Microsoft only accepts the code without declaration.
//The C++ standard mandates the declarations.
template<> const A B<c>::b = {&B<d>::b};
template<> const A B<d>::b = {&B<c>::b};
Workarounds
None
Attachment
None
Comments
Thomas Neumann at 7/7/2005 1:33:59 PM
-
I found out that the standard requires a declaration of the specialization before usage, so the following two lines
template<> const A B<c>::b;
template<> const A B<d>::b;
have to inserted before the last two lines. However bcc32 accepts the code neither with nor without declaration.
Gcc accepts both versions, Comeau and icc require the declaration and Microsoft only accepts the code without declaration. The C++ standard mandates the declarations.
View Your Reports
Search
Server Response from: ETNACODE01
Developer Tools
Blackfish SQL
C++Builder
Delphi
FireMonkey
Prism
InterBase
JBuilder
J Optimizer
HTML5 Builder
3rdRail & TurboRuby
Database Tools
Change Manager
DBArtisan
DB Optimizer
ER/Studio
Performance Center
Rapid SQL
Technical Articles
Tutorials
White Papers
Press Releases
Newsletters
Add Content (GetPublished)
Audio
Audio & Video
Video
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Tags
Technology Partners
Downloads
Free Trials
Registered User Downloads
Beta Programs
Add Content (GetPublished)
Articles
Blogs
Bugs & Suggestions (QualityCentral)
Discussion Forums
Examples (CodeCentral)
Member Services
About
Connect with Us