Some updates to c++11 warning messages and update docs on alias templates

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/branches/gsoc2009-matevz@13847 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-09-21 18:04:15 +00:00
commit dbdbdd94aa
4 changed files with 47 additions and 10 deletions

View file

@ -27,7 +27,7 @@
<li><a href="#Cpp0x_Strongly_typed_enumerations">Strongly typed enumerations</a>
<li><a href="#Cpp0x_Double_angle_brackets">Double angle brackets</a>
<li><a href="#Cpp0x_Explicit_conversion_operators">Explicit conversion operators</a>
<li><a href="#Cpp0x_Template_typedefs">Template typedefs</a>
<li><a href="#Cpp0x_Alias_templates">Alias templates</a>
<li><a href="#Cpp0x_Unrestricted_unions">Unrestricted unions</a>
<li><a href="#Cpp0x_Variadic_templates">Variadic templates</a>
<li><a href="#Cpp0x_New_string_literals">New string literals</a>
@ -382,17 +382,53 @@ SWIG target languages, because all use their own facilities (eg. classes Cloneab
to achieve particular copy and compare behaviours.
</p>
<H3><a name="Cpp0x_Template_typedefs"></a>7.2.15 Template typedefs</H3>
<H3><a name="Cpp0x_Alias_templates"></a>7.2.15 Alias templates</H3>
<p>
The following is an example of an alias template:
<p>SWIG currently parses the new <tt>using name =</tt> syntax, but
ignores the definition:</p>
<div class="code"><pre>
template&lt; typename T1, typename T2, int &gt;
class SomeType {
T1 a;
T2 b;
int c;
};
template&lt; typename T2 &gt;
using TypedefName = SomeType&lt;char*, T2, 5&gt;;
</pre></div>
<p>
These are partially supported as SWIG will parse these and identify them, however, they are ignored as they are not added to the type system. A warning such as the following is issued:
</p>
<div class="shell">
<pre>
example.i:13: Warning 342: The 'using' keyword in template aliasing is not fully supported yet.
</pre>
</div>
<p>
Similarly for non-template type aliasing:
</p>
<div class="code"><pre>
using PFD = void (*)(double); // New introduced syntax
</pre></div>
<p>You should still define the typedefs using the old syntax:</p>
<p>
A warning will be issued:
</p>
<div class="shell">
<pre>
example.i:17: Warning 341: The 'using' keyword in type aliasing is not fully supported yet.
</pre>
</div>
<p>The equivalent old style typedefs can be used as a workaround:</p>
<div class="code"><pre>
typedef void (*PFD)(double); // The old style

View file

@ -454,7 +454,7 @@ CPP0X_TEST_CASES = \
# cpp0x_constructors \ # not supported by any compiler yet
# cpp0x_hash_tables \ # not fully implemented yet
# cpp0x_lambda_functions \ # not supported by GCC or MSVC yet
# cpp0x_template_typedefs \ # not supported by any compiler yet
# cpp0x_template_typedefs \ # not supported by any compiler yet (now in gcc-4.7)
# cpp0x_thread_local \ # not supported by any compiler yet
# cpp0x_unrestricted_unions \ # not supported by any compiler yet (now in gcc-4.6)

View file

@ -1,4 +1,4 @@
/* This testcase checks whether SWIG correctly parses the template aliasing. */
/* This testcase checks whether SWIG correctly parses alias templates. */
%module cpp0x_template_typedefs
%inline %{
@ -12,6 +12,7 @@ class SomeType {
template< typename T2 >
using TypedefName = SomeType<char*, T2, 5>;
// type aliasing
typedef void (*PFD)(double); // Old style
using PF = void (*)(double); // New introduced syntax
%}

View file

@ -3098,9 +3098,9 @@ c_declaration : c_decl {
appendChild($$,firstChild($5));
}
}
| c_lambda_decl { Swig_warning(WARN_CPP11_LAMBDA, cparse_file, cparse_line,"SWIG doesn't produce wrapper code for lambda expressions and closures yet.\n"); $$ = $1; }
| USING idcolon EQUAL { skip_decl(); Swig_warning(WARN_CPP11_ALIAS_DECLARATION, cparse_file, cparse_line,"SWIG doesn't support the 'using' keyword in type aliasing yet.\n"); $$ = 0; }
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL { skip_decl(); Swig_warning(WARN_CPP11_ALIAS_TEMPLATE, cparse_file, cparse_line,"SWIG doesn't support the 'using' keyword in template aliasing yet.\n"); $$ = 0; }
| c_lambda_decl { Swig_warning(WARN_CPP11_LAMBDA, cparse_file, cparse_line,"Lambda expressions and closures are not fully supported yet.\n"); $$ = $1; }
| USING idcolon EQUAL { skip_decl(); Swig_warning(WARN_CPP11_ALIAS_DECLARATION, cparse_file, cparse_line,"The 'using' keyword in type aliasing is not fully supported yet.\n"); $$ = 0; }
| TEMPLATE LESSTHAN template_parms GREATERTHAN USING idcolon EQUAL { skip_decl(); Swig_warning(WARN_CPP11_ALIAS_TEMPLATE, cparse_file, cparse_line,"The 'using' keyword in template aliasing is not fully supported yet.\n"); $$ = 0; }
;
/* ------------------------------------------------------------