[aspectc-user] Does aspectc++ 0.7 fully support gcc 2.96 STL ?

Matthias Urban matthias.urban at pure-systems.com
Fri Jul 4 15:04:01 CEST 2003


Herry Leonard wrote:
> Hi,
> I have another query.
> When I am trying to use STL object inside a function:
> // ----------------------------------
> #include <string>
> void MyFunction()
> {
>     string myStr = "hello";  // parsing is ok
>     vector <int> myVec;    // parsing is ok
>     std::string myStr2 = "hello2";   // parsing is NOT ok
>     std::vector<int> myVec2; 	   // parsing is NOT ok
> }
> // ------------------------------------
> The error during ac++ parsing/compilation when I use std::string and std::vector is:
> * Running ac++ 0.7
> * Simple Dependency Check
> * Handling Translation Unit 'main.cpp'
> ./main.cpp:31: error: invalid statement near token `myStr2'
> ./main.cpp:32: error: invalid statement near token `>'
> Does it mean current aspectc++ 0.7 not yet fully-support STL?
> Thanks.
> Regards,
> Herry Leonard

This looks like a very special problem of the gcc 2.95 and gcc 2.96 
header files and the STL implementation in it. To be compatible with 
older versions of the gcc the use of namespaces (in particular `std') 
depends on the variables __GNUC__ and __GNUC_MINOR__. It seems that in 
your case the namespaces are switched off. You can check it by trying 
the following code in your program:

   namespace std {
     using ::string;
     using ::vector;

If this is the problem you may either use string and vector without 
std:: or give other values to __GNUC__ and __GNUC_MINOR__ (by modifying 
puma.config or using the -D command line option). But at the moment we 
cannot guarantee that ac++ works with all possible values of __GNUC__ 
and __GNUC_MINOR__.

Currently ac++ supports STL (and templates in general) in a way that 
templates are analysed as deep as *needed*, not as deep as possible. 
Above all this means that templates are not really instantiated. But we 
are already working on a better template support and plan to integrate 
it into ac++ in the near future (most of the work is already done).

Best regards,

Matthias Urban                          Phone: (+49) 0391 544569-32
pure-systems GmbH                       Fax:   (+49) 0391 544569-90

More information about the aspectc-user mailing list