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

             Bug #: 12713
           Summary: Unbalanced decltype crashes the frontend
           Product: clang
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++11
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected], [email protected]
    Classification: Unclassified


#include <type_traits>

template<class T>
void foo(typename std::conditional<false, decltype((1), int>::type)
{
}

int main()
{
    return foo<int>(0);
}

Note the missing second ) in the argument definition of foo. Compiling this
code results in an assert on my machine:

bar.cpp:6:6: error: expected '(' for function-style cast or type
      construction
                int>::type)
                ~~~^
clang: /srv/build/clang-svn/src/llvm/tools/clang/lib/Lex/PPCaching.cpp:101:
void clang::Preprocessor::AnnotatePreviousCachedTokens(const clang::Token &):
Assertion `CachedTokens[CachedLexPos-1].getLastLoc() ==
Tok.getAnnotationEndLoc() && "The annotation should be until the most recent
cached token"' failed.

-- 
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.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to