This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gcc interp rets C++0x initializ ation cons truct as f unction de claration‏



Hello,
 
For the following code:
 
struct S
{
    int a;
    float b;
};
 
struct T
{
    T(S s) {}
};
 
int main()
{
    T t(S{1, 0.1}); // ERROR HERE
}
 
gcc 4.6 trunk gives the following errors (with the --std=c++0x option):
 
decl.cpp: In function 'int main()':
decl.cpp:14:10: error: expected ')' before '{' token
decl.cpp:14:10: error: a function-definition is not allowed here before '{' token
decl.cpp:14:18: error: expected primary-expression before ')' token
decl.cpp:14:18: error: expected ';' before ')' token
 
It seems gcc is interpreting the statement as a function declaration.
 
Is this the desired behaviour?
 
Regards,
Nate. 		 	   		  


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]