[LLVMbugs] [Bug 11454] New: Many semantic errors that como finds but clang++ v3.0 doesn't

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Nov 29 11:56:04 PST 2011


http://llvm.org/bugs/show_bug.cgi?id=11454

             Bug #: 11454
           Summary: Many semantic errors that como finds but clang++ v3.0
                    doesn't
           Product: clang
           Version: 2.9
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: ggreif at gmail.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified


I am compiling this file
http://catatonic.googlecode.com/svn/branches/nested/main.cpp?r=84

with clang v3.0

and get 2 errors:


main.cpp:198:29: error: implicit instantiation of template 'Expr<int>' within
its own definition
    typedef struct LitInt : Expr<int>
                            ^
main.cpp:202:32: error: implicit instantiation of template 'Expr<bool>' within
its own definition
      typedef struct LitBool : Expr<bool>
                               ^
I am not totally convinced why these have to be errors, as they come from
inside of a member template that is not instantiated itself in the definition
of Expr. So at istantiation time Expr would surely already be completed...

[Btw. clang 2.9 did not issue these.]

When compiling with "como" I get many more errors:

"main.cpp", line 143: error: incomplete type is not allowed
          typedef struct Nil : List
                               ^
--> List is an abbreviation for List<T> here, maybe this is fooling clang?

"main.cpp", line 147: error: incomplete type is not allowed
              typedef struct Cons : List
                                    ^
--> same

"main.cpp", line 145: error: "List" is not a nonstatic data member or base
          class of class "List<T>::__<<unnamed>>::Nil"
        Nil(void) : List(1) {}
                    ^
--> possibly a consequent error?

"main.cpp", line 151: error: "List" is not a nonstatic data member or base
          class of class "List<T>::__<<unnamed>>::Nil::Cons"
            Cons(const T& payload, List& next) : List(2), payload(payload),
next(next) {}
                                                 ^
--> same

"main.cpp", line 198: error: incomplete type is not allowed
      typedef struct LitInt : Expr<int>
                              ^
--> like line 147

"main.cpp", line 202: error: incomplete type is not allowed
        typedef struct LitBool : Expr<bool>
                                 ^
--> like line 147

"main.cpp", line 206: error: incomplete type is not allowed
      typedef struct Add : Expr<int>
                           ^
--> like line 147

"main.cpp", line 211: error: incomplete type is not allowed
        typedef struct Mul : Expr<int>
                             ^
--> like line 147

"main.cpp", line 216: error: incomplete type is not allowed
          typedef struct Cond : Expr
                                ^
--> like line 147

"main.cpp", line 201: error: "Expr" is not a nonstatic data member or base
          class of class "Expr<T>::__<<unnamed>>::LitInt"
        LitInt(int i) : Expr(1), i(i) {}
                        ^

"main.cpp", line 205: error: "Expr" is not a nonstatic data member or base
          class of class "Expr<T>::__<<unnamed>>::LitInt::LitBool"
      LitBool(bool b) : Expr(2), b(b) {}
                        ^
--> like line 145

"main.cpp", line 210: error: "Expr" is not a nonstatic data member or base
          class of class "Expr<T>::__<<unnamed>>::LitInt::LitBool::Add"
        Add(const Expr<int>& lhs, const Expr<int>& rhs) : Expr(3), lhs(lhs),
rhs(rhs) {}
                                                          ^
--> like line 145

"main.cpp", line 215: error: "Expr" is not a nonstatic data member or base
          class of class "Expr<T>::__<<unnamed>>::LitInt::LitBool::Add::Mul"
          Mul(const Expr<int>& lhs, const Expr<int>& rhs) : Expr(4), lhs(lhs),
rhs(rhs) {}
                                                            ^
--> like line 145

"main.cpp", line 221: error: "Expr" is not a nonstatic data member or base
          class of class
          "Expr<T>::__<<unnamed>>::LitInt::LitBool::Add::Mul::Cond"
            Cond(bool b, const Expr& thn, const Expr& els) : Expr(5), b(b),
thn(thn), els(els) {}
                                                             ^
--> like line 145

"main.cpp", line 418: warning: missing return statement at end of non-void
          function "App<F, A>::force [with F=Plus, A=Two]"
      }
      ^
          detected during instantiation of "F::simplify::App<A>::simplify
                    App<F, A>::force() [with F=Plus, A=Two]" at line 448

--> not detected by clang (also not by g++ 4.2)

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list