From 4da940e603372936c577f95329d7971a3fac8b1e Mon Sep 17 00:00:00 2001
From: Guido Kanschat
-
- Here, the compiler reports
-
- template <int dim> struct Function {};
- template <int dim> struct RHS : Function<dim> { RHS() {}; };
-
- template <int dim> void f () {
- const RHS<dim> rhs;
- };
- template void f<1> ();
-
-
-
+
- x.cc: In function `void f () [with int dim = 1]':
- x.cc:7: instantiated from here
- x.cc:5: uninitialized const `rhs'
-
-
+ template <int dim> struct Function {}; + template <int dim> struct RHS : Function<dim> { RHS() {}; }; + + template <int dim> void f () + { + const RHS<dim> rhs; + }; + template void f<1> (); ++ +
Here, the compiler reports
++ x.cc: In function `void f () [with int dim = 1]': + x.cc:7: instantiated from here + x.cc:5: uninitialized const `rhs' ++
which is clearly bogus since rhs
uses the default constructor of
the class. Unfortunately, there is no way of working around the bug short of
removing the constness of the variable. We did not want to do this, since
--
2.39.5