Fix some C++11 identifiers with special meaning parsing problems
Fix parsing of C++11 identifiers with special meaning (final and override) when they are used as part of the scope name of an identifier, such as a namespace name. Closes #1679
This commit is contained in:
parent
66752cde48
commit
aa47b4c438
3 changed files with 38 additions and 2 deletions
|
|
@ -7,6 +7,10 @@ the issue number to the end of the URL: https://github.com/swig/swig/issues/
|
||||||
Version 4.0.2 (in progress)
|
Version 4.0.2 (in progress)
|
||||||
===========================
|
===========================
|
||||||
|
|
||||||
|
2019-12-10: wsfulton
|
||||||
|
#1679 Fix parsing of C++11 identifiers with special meaning (final and override) when
|
||||||
|
they are used as part of the scope name of an identifier, such as a namespace name.
|
||||||
|
|
||||||
2019-11-26: wsfulton
|
2019-11-26: wsfulton
|
||||||
[C#] #1628 'out' or 'ref' used in a cstype typemap was not always stripped out in parts
|
[C#] #1628 'out' or 'ref' used in a cstype typemap was not always stripped out in parts
|
||||||
of director code generation.
|
of director code generation.
|
||||||
|
|
|
||||||
|
|
@ -138,3 +138,31 @@ void DerivedNoVirtualStruct::ef() {}
|
||||||
DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
|
DerivedNoVirtualStruct::~DerivedNoVirtualStruct() {}
|
||||||
%}
|
%}
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
namespace Outer {
|
||||||
|
namespace final {
|
||||||
|
template <typename T> struct smart_ptr {
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
namespace override {
|
||||||
|
template <typename T> struct dumb_ptr {
|
||||||
|
typedef T type;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}
|
||||||
|
|
||||||
|
%template(SmartPtrBaseStruct) Outer::final::smart_ptr<DerivedStruct>;
|
||||||
|
|
||||||
|
%inline %{
|
||||||
|
class ObjectDB
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
static void smart1(typename Outer::final::smart_ptr<DerivedStruct>::type *objectT) {}
|
||||||
|
static void smart2(Outer::final::smart_ptr<DerivedStruct>::type *objectT) {}
|
||||||
|
static void dumb1(typename Outer::override::dumb_ptr<DerivedStruct>::type *objectT) {}
|
||||||
|
static void dumb2(Outer::override::dumb_ptr<DerivedStruct>::type *objectT) {}
|
||||||
|
static Outer::final::smart_ptr<DerivedStruct>::type get() { return DerivedStruct(); }
|
||||||
|
};
|
||||||
|
%}
|
||||||
|
|
|
||||||
|
|
@ -873,10 +873,14 @@ int yylex(void) {
|
||||||
return (USING);
|
return (USING);
|
||||||
if (strcmp(yytext, "namespace") == 0)
|
if (strcmp(yytext, "namespace") == 0)
|
||||||
return (NAMESPACE);
|
return (NAMESPACE);
|
||||||
if (strcmp(yytext, "override") == 0)
|
if (strcmp(yytext, "override") == 0) {
|
||||||
|
last_id = 1;
|
||||||
return (OVERRIDE);
|
return (OVERRIDE);
|
||||||
if (strcmp(yytext, "final") == 0)
|
}
|
||||||
|
if (strcmp(yytext, "final") == 0) {
|
||||||
|
last_id = 1;
|
||||||
return (FINAL);
|
return (FINAL);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (strcmp(yytext, "class") == 0) {
|
if (strcmp(yytext, "class") == 0) {
|
||||||
Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");
|
Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue