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
diff --git a/CHANGES.current b/CHANGES.current
index 39ec98e..09facd9 100644
--- a/CHANGES.current
+++ b/CHANGES.current
@@ -7,6 +7,10 @@
 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
             [C#] #1628 'out' or 'ref' used in a cstype typemap was not always stripped out in parts
             of director code generation.
diff --git a/Examples/test-suite/cpp11_final_override.i b/Examples/test-suite/cpp11_final_override.i
index 8d275b3..c31ae73 100644
--- a/Examples/test-suite/cpp11_final_override.i
+++ b/Examples/test-suite/cpp11_final_override.i
@@ -138,3 +138,31 @@
 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(); }
+};
+%}
diff --git a/Source/CParse/cscanner.c b/Source/CParse/cscanner.c
index 4566817..7a9c05c 100644
--- a/Source/CParse/cscanner.c
+++ b/Source/CParse/cscanner.c
@@ -873,10 +873,14 @@
 	  return (USING);
 	if (strcmp(yytext, "namespace") == 0)
 	  return (NAMESPACE);
-	if (strcmp(yytext, "override") == 0)
+	if (strcmp(yytext, "override") == 0) {
+	  last_id = 1;
 	  return (OVERRIDE);
-	if (strcmp(yytext, "final") == 0)
+	}
+	if (strcmp(yytext, "final") == 0) {
+	  last_id = 1;
 	  return (FINAL);
+	}
       } else {
 	if (strcmp(yytext, "class") == 0) {
 	  Swig_warning(WARN_PARSE_CLASS_KEYWORD, cparse_file, cparse_line, "class keyword used, but not in C++ mode.\n");