Yesterday (2007-4-25) I downloaded gcc 4.2 and ran into a problem with g++
as illustrated here:

     template<class T>
     struct xyz {
        T x, y, z;
     };

     template<class T>
     struct myclass {
        void fun(void);
     };

     template<class T>
     void myclass<T>::fun(void)
     {
        static xyz<T> var;
        #ifdef _OPENMP
           #pragma omp threadprivate(var)
        #endif
     }

     int main(void)
     {
     }

% g++ -fopenmp code.cc
code.cc: In member function 'void myclass<T>::fun()':
code.cc:16: error: 'threadprivate' 'var' has incomplete type

Perhaps I'm missing something, but I don't see how var's type can
be incomplete in this example.

Note: compiles if either or both of xyz and myclass is a non-template,
so this doesn't seem to be the same problem reported in 27557.


-- 
           Summary: threadprivate with function block static reports
                    incomplete type
           Product: gcc
           Version: 4.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mstaley at lanl dot gov


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31708

Reply via email to