Log On
Embarcadero Home
Watch, Follow, &
Connect with Us
Share This
QualityCentral
Communities
Articles
Blogs
Resources
Downloads
Help
QualityCentral
Delphi-BCB
Compiler
C++
Front End
access
Bitfields
Destructors
Diagnostics
Exception Handling
Extensions
Initialization
Inline Assembly
Invocation
Language
Mangling Scheme
Namespaces
Object Generation
Overloading
Pragmas
Pre-Compiled Headers
Preprocessor
Refactoring
RTTI
Templates
You are not logged in.
Help
Print
Public Report
Report From:
Delphi-BCB/Compiler/C++/Front End/Language
[ Add a report in this area ]
Report #:
10267
Status:
Closed
The compiler obligatorily converts member arrays to pointers
Project:
C++Builder
Build #:
6.0.10.161
Version:
10.0
Submitted By:
Christopher Yeleighton
Report Type:
Basic functionality failure
Date Reported:
1/11/2005 1:01:17 PM
Severity:
Commonly encountered problem
Last Updated:
3/20/2012 2:24:39 AM
Platform:
All versions
Internal Tracking #:
237290
Resolution:
Fixed
(Resolution Comments)
Resolved in Build:
:
12.0.2978.11303
Duplicate of:
None
Voting and Rating
Overall Rating:
(2 Total Ratings)
4.00 out of 5
Total Votes:
11
Description
The identifiers in this piece correspond to errors they generate. The message log is appended. The constructs used in this code do not compile mainly because the compiler does not recognize a member array as an array but it converts a reference to the member to the corresponding pointer. It does not happen with local arrays, global arrays and static arrays qualified by type name.
[C++ Warning] nocr.cpp(8): W8028 Temporary used to initialize 'E2034'
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Error] nocr.cpp(8): E2034 Cannot convert 'int *' to 'int[1]'
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Error] nocr.cpp(9): E2027 Must take address of a memory location
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Error] nocr.cpp(10): E2031 Cannot cast from 'int *' to 'int ( &)[1]'
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Error] nocr.cpp(11): E2285 Could not find a match for 'E2285<T,N>(int *)'
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Error] nocr.cpp(12): E2285 Could not find a match for 'E2285<T,N>(int *)'
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Warning] nocr.cpp(13): W8004 'E2031' is assigned a value that is never used
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Warning] nocr.cpp(13): W8004 'E2027' is assigned a value that is never used
Full parser context
nocr.cpp(6): parsing: void testlocam()
[C++ Warning] nocr.cpp(13): W8004 'E2034' is assigned a value that is never used
Full parser context
nocr.cpp(6): parsing: void testlocam()
Steps to Reproduce:
Try compiling the following piece of code:
struct testarrmem { static int x[01]; int y[01]; };
template<class T, unsigned N>
void E2285(T (&)[N]);
void testlocam(void) {
testarrmem z;
int (&E2034)[01] = z.x;
int (*E2027)[01] = &z.x;
int (&E2031)[01] = (int (&)[01]) z.y;
E2285(z.x);
E2285(z.y);
}
Workarounds
E2034, E2027: Replace z.x with testarrmem::x
E2031: remove the explicit cast
E2285: use f(T (*)[N]) instead of f(T (&)[N]), i.e. pass a pointer to an array instead of a reference
Attachment
None
Comments
None
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