SUN 4.2 and 5.3 compiler.

We are in process of upgrading our system from SUN 4.2 compiler to 5.3 and facing some problem.
Here is the very simple code for your reference.
// File test.cpp (start)
// ----------------part of code which I can not change (start) ------------------
template <class T>
class A
public:
typedef T* pointer;
typedef T& reference;
A(T& b) : a(b) {}
private:
reference a;
typedef A<void>::reference B;
//----------------part of code which I can not change (end) ------------------
void main()
int a = 10;
A<void> b(void);
// File test.cpp (end)
The same code I am able to compile with 4.2 with out any problem.
Here is the error message I am getting with 5.3 compiler.
.../apurohit<183> /opt/SUNWspro/bin/CC -V -compat=4 test.cpp
CC: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
ccfe: Sun WorkShop 6 update 2 C++ 5.3 2001/05/15
"trial.cpp", line 6: Error: Cannot declare a reference to void.
"trial.cpp", line 12: Where: While specializing "A<void>".
"trial.cpp", line 12: Where: Specialized in non-template code.
"trial.cpp", line 7: Error: Cannot declare a reference to void.
"trial.cpp", line 12: Where: While specializing "A<void>".
"trial.cpp", line 12: Where: Specialized in non-template code.
"trial.cpp", line 15: Warning (Anachronism): main() must have a return type of int.
2 Error(s) and 1 Warning(s) detected.
I know the reason for the error, but I want to know is there any solution for this problem?
Thanks in advance.

Template class A creates references to the type it is instantiated on. If you instantiate on type void, the code is invalid, because you cannot create a void&. (By definition, a reference must be initialized with an actual object, and there are no void objects.) C++ 4.2 was wrong to accept the invalid code.
Clearly, you should not be trying to create type A<void>. If you need A<void> for some reason, you can create a specialization on void that does not generate any references to void. For example, add this code prior to any mention of A<void>:
template<> class A<void> {
public:
typedef void* pointer;
private:
Ideally, this code should be added to the header that defines class template A, immediately after the primary template definition.
Type A<void>::pointer will be valid, but not A<void>::reference. And you cannot create an A<void> object that has a reference member. You could have a pointer member, but usage of A<void> would then not be the same as the usage of A<T> for other types T.
You say you cannot change the code. I'm afraid you will have to change the code, because I don't know of any compiler that will accept this invalid code.

Similar Messages

  • Import com.sun.j3d.loaders.Scene - no longer compiles - what package?

    import com.sun.j3d.loaders.Scene -- this line compiled back in 2002, but is not supported under the current Java Development Package. Does anyone know the replacement package? I installed Java3D and JDIC, but my compiler still complains of an error. I read that JDIC got moved to org.jdesktop, but I tried
    import org.jdesktop.j3d.loaders.Scene -- this did not work either. Can someone tell me what package I need to include in my class path to get my compiler to recognize loaders.Scene?
    Thanks in advance.

    Nevermind this post. I added my vrml97 package to the runtime library, but I forgot to add it to the compile library. Oops.

  • [RANT] Lack of sync between Sun sales channels and reality

    Hi,
    This being a technical forum, I'm pretty sure this is OT but I simply have run up against brick walls almost everywhere else. If anybody can advise where I can direct this to with some positive results/feedback, I'd be very thankful for it.
    We are small ISV shop in Malaysia specializing in applications for the banking sector. Up till last year, all our applications were deployed on Tomcat and I started a move towards a Sun-centric platform since the beginning of 2007. Development has had its challenges, including a nail-biting 3 months fervently hoping that Glassfish V2 would be released into production status before my first big deployment on GF was to be launched. Thankfully, the GF team delivered big time and we have had our application in the wild for the past 2 weeks. I confess to not having sufficient depth of knowledge in GF still and look forward to learning more but at least we're off to a start (and being paid for it).
    Being a small entity and not being very familiar with the internal workings of GF, I had advised our client (one of the major banks in Malaysia) to take up SJSAS subscription along with SJSWS and DSEE which I had included in our deployment. However, that has been a story of major frustration leading up to this post.
    We have approached no less than 3 Sun sales channel partners in Malaysia (2 of which are pretty darned big in our local context) and the quotations we got are simply not reflective of Schwartz-era policies. It seems that the price lists that they have still list SJSAS at version 8.1 and it includes pricing for a license component AND support component. I had specifically told our client that the production usage license component for all Sun software listed above was granted by Sun FOC and that they only had to subscribe to support. The channel sales reps refused to budge saying that "in order to qualify for support, you need a license; and according to your price lists, you need to pay". We brought this up to a Sun pre-sales consultant asking him to intervene and his answer was basically "what they said". I was speechless at that point and just asked him to read through his CEO's blog when he had the time to.
    Right now, we're already in production and none of the software listed have support contracts. That being the case and us being the deployers, it goes without saying that when the shit hits the fan, we're going to get splattered. This is a ticking time bomb for me and I have no idea where to go next regarding this. I have been posting to the forums quite often asking for help and thankfully, all of youse Sun engineers who frequent the forums have been very helpful for the most part. There are still some unanswered questions though and I'm just praying that nothing serious comes out of those issues.
    Ultimately though, my client still needs an official support contract and they are already grumbling that I made the wrong choice in a platform. Tomcat was opensource too but to be realistic, the community mindshare over there is way higher than that of GF's and most of my questions would probably be FAQs already by the time I think of them.
    So please, if anybody knows how I can get some headway in this issue, I would be very thankful and feel vindicated in my decision to move on to the Sun platform. Most of you reading this would probably not even know where Malaysia is apart from some obscure references from watching Discovery Travel & Adventure but there IS a Sun presence here and this would be a great opportunity for Sun to gain official recognition for providing the base application platform for a major financial institution here.
    Thanks,
    Wong

    Hi there,
    I want to make sure I understand your issue here.
    So, what version of Application Server do you have that you need support for?
    If you have SJS Application Server 9.1 you can buy subscription either by contacting your sales person or doing that online, if it is for no more than 32 sockets.. (This can be done online)
    The Application Server Subscriptions provides you Software Idemnification and one year support - You can choose from Standard, Premium, and premium plus.
    Check this site:
    http://www.sun.com/service/applicationserversubscriptions/index.xml
    Please let me know if you have any questions.

  • Sun Management Center and Reduced Core Installs

    hey all,
    I just discovered the Sun Management Center and the tool looks great for the servers I need to manage. However due to security reasons all our servers are installed as Reduced Network Core installs where we then add the minimal extra packages.
    At the moment I am still testing everything but I am a bit stuck here and I believe that I might be missing some packages. I can get the server to find the agent but there I cannot load any of the modules. Sniffing the traffic does seem to show that the info is sent ( a list of names I recognise as module names) but the console does not show anything and reports an error unable to load module info.
    Is there a full package list that is required to run the management center server and client? The agent runs fine on my desktop but that is a full install.
    I already noticed the command ping is required, but am unsure about snmp daemons. What other packages will i need to install? The manual doesn't really give any information on that and seems to start from a full install

    Never mind,
    The problem was in the firewall who was defragmenting packets. Once I disabled that feature the server worked fine.
    Seems just ping is enough to get the installer working.

  • Real Application Cluster on Sun Solaris 8 and Sun Cluster 3

    Hello,
    we want to install Oracle 9i Enterprise Edition in combination with Oracle Real Application Cluster-Option on 2 Nodes. Every node (12-CPU-SMP-Machine) should running Sun Solaris 8 and Sun Cluster 3 Service.
    Does this configuration work with ORAC? I found nowhere informations about. Is there anything I have to pay special attention for during installation?
    Thank you for helping and best regards from Berlin/Germany
    Michael Wuttke

    Forms and report services work fine on solaris 8.
    My problem is on the client side.
    I have to use solaris 8 with netscape like forms clients
    and I wasn't able to make it work with java plugins.
    Any solution?
    Mauro

  • RoboHelp  for Word 7 is not saving the rtf and won't compile .hlp

    I use RoboHelp for Word 7 to produce WinHelp files. It's been working fine for several months on this computer.
    Just in the past week, I had an issue with my Word 2007 when trying to open a .doc file. I got the message that the converter nswrd632.wpc wasn't found. After searching on the Microsoft forums, I edited the registry and registered that converter.
    But now (and this may be unconnected to the Word converter message) RH won't save the .docx or .rtf file. Whenever I click Save All, nothing happens. When I click Exit Project, the message comes up about needing to save the files, and I click Yes to All. Nothing happens except the message closing. No files are saved and RH does not exit. The only way I can exit RH is to click No, which of course means my changes aren't saved. I can't save the .docx file through the Word menu, either.
    I also cannot compile the file. Again, no error message, just doesn't compile.
    I have searched the forums for RH for Word, with the result that I've reinstalled RH, made sure the RH add-ins are enabled, and deleted all the .dot files. Nothing is working. I went to Peter Grainge's Snippet 112 and followed the directions there--no change.
    I have found that after making my edits in the Word document, if I manually save the RTF file by going to the Word Save As directory, the edits will be saved and RH will compile the .hlp file - one time.
    Any ideas?

    Hi, I have a nearly identical problem, except my project uses .doc files instead of .rtf files. I was able to solve the "cannot save" problem by following the information below. I still have not resolved the "cannot compile" problem.
    I'm using Windows XP, RH7 Build 100, Office 2007. My project was created using Office 2003 and I did not experience any of these issues until I recently upgraded to Office 2007.
    This fix was sent to me by my group's "tech" guy.
    A number of Adobe RoboHelp for Word 7 users have reported that they cannot save changes or generate an output. The cause has been isolated to the RHComAdd.DLL being disabled.
    Check for that in Word:
    For versions up to 2003 go to Help | About | Disabled Items. If RHComAdd.DLL appears, re-enable it.
    For Word 2007, go to the Office Button | Word Options | Add-ins. Under "Manage" select Disabled Items and click Go. If RHComAdd.DLL appears, highlight it and re-enable it. (THIS IS WHAT I DID)
    Alternatively, you can re-register the DLL. Go to Start | Run and type in the following line, assuming you have installed RoboHelp to the default location.
    regsvr32 "C:\Program Files\Adobe\Adobe RoboHelp 7\RoboHELP\RHComAdd.dll"
    How does this DLL get disabled? The cause has been identified as a Word document being opened in Internet Explorer rather than in Word.
    This problem was fixed in Build 7.0.2.
    Hope this helps you. I'm still working on the compile error.
    -Shannon Mooney

  • Install both Sun Application server and Jboss application server- Can I?

    Dear all,
    I am programmer and want to test for something.
    Is it possible to install sun application server and jboss application server in the same computer (Windows XP Professional)?
    Is there any special attention I need to take?

    I am programmer and want to test for something.Allowed.
    Is it possible to install sun application server and jboss application server in the same computer (Windows XP Professional)?Why do you think it may not be possible ?
    Is there any special attention I need to take?just the way the URL is populated.

  • [svn:fx-trunk] 16317: Adding mx/mx. swc to list of paths so arcade and zen will compile.

    Revision: 16317
    Revision: 16317
    Author:   [email protected]
    Date:     2010-05-25 14:40:09 -0700 (Tue, 25 May 2010)
    Log Message:
    Adding mx/mx.swc to list of paths so arcade and zen will compile.
    Modified Paths:
        flex/sdk/trunk/samples/themes/arcade/build.xml
        flex/sdk/trunk/samples/themes/zen/build.xml

    Gordon, it looks like its been a while since you made this post.  Not sure how valid it is now...   I am particularly interested in the LigatureLevel.NONE value.  It seems that it is no longer supported.
    How do I turn of ligatures in the font rendering?
    My flex project involves trying to match the font rendering of Apache's Batik rendering of SVG and ligatures have been turned off in that codebase.  Is there any way (even roundabout) to turn ligatures off in flash?
    Thanks,
    Om

  • How to access date and time of compiled forms

    hi all
    i want to access the date ,time and size of compiled forms that are stored in a particular folder.
    can anybody tell me how to access it.
    thanx
    Message was edited by:
    new.oradev

    hi all
    i want to access the date ,time and size of compiled
    forms that are stored in a particular folder.
    can anybody tell me how to access it.
    thanx
    Message was edited by:
    new.oradevIs this an Oracle Forms question???
    You can always use your operating system to check the creation/modification/access dates of a file on your file system.
    If you're looking for versioning, I suggest you read abot OSCM (Oracle Software Configuration Manager)
    Tony

  • Problem after kernel updation Sun OS 8 and SAP 4.7

    Hi...
    I have updated kernel from 620 to 640 (patch 223).
    Now after upgrading i am getting error as below while starting SAP.
    ld.so.1: R3trans: fatal: libCstd.so.1: open failed: No such file or directory
    Killed
    I found that libCstd.so.1 is missing as--
    bash-2.03# ldd R3trans
         libdl.so.1 =>      /usr/lib/64/libdl.so.1
         libnsl.so.1 =>      /usr/lib/64/libnsl.so.1
         libsocket.so.1 =>      /usr/lib/64/libsocket.so.1
         libCstd.so.1 =>      (file not found)
         libCrun.so.1 =>      /usr/lib/64/libCrun.so.1
         libm.so.1 =>      /usr/lib/64/libm.so.1
         libthread.so.1 =>      /usr/lib/64/libthread.so.1
         libw.so.1 =>      /usr/lib/64/libw.so.1
         libc.so.1 =>      /usr/lib/64/libc.so.1
         libmp.so.2 =>      /usr/lib/64/libmp.so.2
         /usr/platform/SUNW,Sun-Fire-280R/lib/sparcv9/libc_psr.so.1
    Now problem is that how to get this librery and in which package.  OS is Sun OS5.8 and SAP 4.7.
    Regards,
    Abhimanyu

    Update SUNWlibC patches & SUNWlibCx patches and get the desired librery.
    Regards,
    Abhimanyu

  • Compare performance SUN SPARC IV+ and SPARC VII

    Anyone have experience on SUN Sparc VII and Compare Performance between SUN Sparc IV+ and Sparc VII ?
    Thank.

    read http://blogs.sun.com/mrbenchmark/
    particularly http://blogs.sun.com/mrbenchmark/entry/oltp_performance_of_the_sun

  • Sun PCi II and III drivers

    Hi All,
    Can the drivers and software for sun PCi II and III cards be downloaded?
    I searched in any possible way on sun.com, sunsolve, etc, it was hard to find even the documentation about them, but now I got that at least.
    What about the software? Can it be downloaded? Where from?
    EZ

    Replying to my own post:
    Did this answer your question ?
    I would like to remove the topic from my watch list.
    Michael

  • Is there any difference between sun solaris 8 and windows for Garb.Collecti

    Hi All,
    is there any difference between refreshing the java virtual memory between sun solaris 8 and windows.i am fetching 25 records for every search action.in windows usage of java virual memory is 5 mb after every search it refreshes the memory.while using the same code in sun solaris 8 it throws heap out of memory error and for every search it wont refresh the memory.

    Some other related links
    http://java.sun.com/docs/hotspot/gc5.0/gc_tuning_5.html
    http://e-docs.bea.com/wls/docs81/perform/JVMTuning.html

  • Are SUN StorEdge c2 and  Sun Storagetek C2 the same ?

    Hello All,
    Are SUN StorEdge c2 and Sun Storagetek C2 the same ? or are they 2 different products.
    Thanks
    Venkat Jupalli

    mmmmn, not sure about this one, but I would assume that moving from StorEdge to Storagetek is brand name related and came about from Sun Microsystems' acquisition of StorageTek late '05. Call marketing for more information.

  • Aggressive JSP and TAG file Compilation?

    I get JSP and TAG file compile errors only when I touch and save the file. Isn't there a way to get these to build automatically by the NitroX builder? I'm constantly getting Jasper compile errors at runtime and having problems when I rename/refactor code that is referenced by .tag files.
    Thanks,
    Mike

    Hi,
    Does this happen to all of your JSP files?
    Please check these settings and update the status:
    * Is your project associated with source control or present on local drive?
    * Window > Preferences > Workbench (General > workspace) - Build automatically
    * Project > Properties > Builders
    - Java Builder
    - NitroX AppXRay Builder
    Did the behavior change due to any of the recent modification/upgrade?
    What version of Eclipse & NitroX are you using?
    * Help > About NitroX > Click on Eclipse icon - Version & build id
    * Help > About NitroX > Click on NitroX icon - Version & build id
    Thanks,
    M7 Support

Maybe you are looking for