Added warning for initializer_list introduced in C++0x.
Added testcase cpp0x_initializer_list. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@11540 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
bc8f86b6ec
commit
dccbc68c70
4 changed files with 37 additions and 16 deletions
|
|
@ -415,7 +415,8 @@ CPP0X_TEST_CASES = \
|
||||||
cpp0x_decltype \
|
cpp0x_decltype \
|
||||||
cpp0x_result_of \
|
cpp0x_result_of \
|
||||||
cpp0x_default_delete \
|
cpp0x_default_delete \
|
||||||
cpp0x_sizeof_object
|
cpp0x_sizeof_object \
|
||||||
|
cpp0x_initializer_list
|
||||||
# cpp0x_template_typedefs # not supported by any compiler yet
|
# cpp0x_template_typedefs # not supported by any compiler yet
|
||||||
# cpp0x_hash_types # not fully implemented yet
|
# cpp0x_hash_types # not fully implemented yet
|
||||||
# cpp0x_constructors # not supported by any compiler yet
|
# cpp0x_constructors # not supported by any compiler yet
|
||||||
|
|
|
||||||
13
Examples/test-suite/cpp0x_initializer_list.i
Normal file
13
Examples/test-suite/cpp0x_initializer_list.i
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
/* This testcase checks whether Swig correctly uses the new initializer_list
|
||||||
|
introduced in C++0x. */
|
||||||
|
%module cpp0x_initializer_list
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
#include <initializer_list>
|
||||||
|
|
||||||
|
class A {
|
||||||
|
public:
|
||||||
|
A( std::initializer_list<int, int> ) {}
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
||||||
|
|
@ -4265,21 +4265,27 @@ cpp_member : c_declaration { $$ = $1; }
|
||||||
|
|
||||||
cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
|
cpp_constructor_decl : storage_class type LPAREN parms RPAREN ctor_end {
|
||||||
if (Classprefix) {
|
if (Classprefix) {
|
||||||
SwigType *decl = NewStringEmpty();
|
if (Getattr($4,"type") && strstr(Char(Getattr($4,"type")), "initializer_list<")) {
|
||||||
$$ = new_node("constructor");
|
/* Ignore constructors containing initializer_list<> introduced in C++0x */
|
||||||
Setattr($$,"storage",$1);
|
Swig_warning(WARN_LANG_INITIALIZER_LIST, cparse_file, cparse_line, "Constructor with std::initializer_list<> argument ignored.\n");
|
||||||
Setattr($$,"name",$2);
|
$$ = 0;
|
||||||
Setattr($$,"parms",$4);
|
} else {
|
||||||
SwigType_add_function(decl,$4);
|
SwigType *decl = NewStringEmpty();
|
||||||
Setattr($$,"decl",decl);
|
$$ = new_node("constructor");
|
||||||
Setattr($$,"throws",$6.throws);
|
Setattr($$,"storage",$1);
|
||||||
Setattr($$,"throw",$6.throwf);
|
Setattr($$,"name",$2);
|
||||||
if (Len(scanner_ccode)) {
|
Setattr($$,"parms",$4);
|
||||||
String *code = Copy(scanner_ccode);
|
SwigType_add_function(decl,$4);
|
||||||
Setattr($$,"code",code);
|
Setattr($$,"decl",decl);
|
||||||
Delete(code);
|
Setattr($$,"throws",$6.throws);
|
||||||
}
|
Setattr($$,"throw",$6.throwf);
|
||||||
SetFlag($$,"feature:new");
|
if (Len(scanner_ccode)) {
|
||||||
|
String *code = Copy(scanner_ccode);
|
||||||
|
Setattr($$,"code",code);
|
||||||
|
Delete(code);
|
||||||
|
}
|
||||||
|
SetFlag($$,"feature:new");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$$ = 0;
|
$$ = 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,7 @@
|
||||||
#define WARN_LANG_DIRECTOR_ABSTRACT 517
|
#define WARN_LANG_DIRECTOR_ABSTRACT 517
|
||||||
#define WARN_LANG_PORTABILITY_FILENAME 518
|
#define WARN_LANG_PORTABILITY_FILENAME 518
|
||||||
#define WARN_LANG_TEMPLATE_METHOD_IGNORE 519
|
#define WARN_LANG_TEMPLATE_METHOD_IGNORE 519
|
||||||
|
#define WARN_LANG_INITIALIZER_LIST 520
|
||||||
|
|
||||||
/* -- Reserved (600-799) -- */
|
/* -- Reserved (600-799) -- */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue