[Bug c++/43913] New: error: ‘<expression error>’ is not a valid template argument for type ‘int’ because it is a non-constant expression

manu at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Tue Apr 27 20:46:00 GMT 2010


/home/manuel/src/test/gcc/testsuite/g++.dg/template/recurse3.C: In
instantiation of ‘const int Y<1000>::value’:
/home/manuel/src/test/gcc/testsuite/g++.dg/template/recurse3.C:17:17:  
instantiated from here
/home/manuel/src/test/gcc/testsuite/g++.dg/template/recurse3.C:13:46: error:
‘<expression error>’ is not a valid template argument for type ‘int’ because it
is a non-constant expression

Testcase is related to PR9335.

// PR c++/9335
// We should not see an error about non-constant initialization.
// { dg-do compile }
// { dg-options "-ftemplate-depth-15" }
template<int N> struct Y;
template <int N> struct X {
  static const int value = X<Y<N-1>::value>::value;
  // { dg-message "skipping \d instantiation contexts" "" { target *-*-* } 0 }
  // { dg-bogus "expression error" "" { xfail *-*-* } 0 }
};

template <int N> struct Y {
  static const int value = Y<X<N-1>::value>::value;  // { dg-error "incomplete
type" }

};

template struct Y<1000>;


-- 
           Summary: error: ‘<expression error>’ is not a valid template
                    argument for type ‘int’ because it is a non-constant
                    expression
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: manu at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list