[LLVMbugs] [Bug 23388] New: Template compilation failure with -fdelayed-template-parsing when compiling an AST loaded from a PCH/AST file

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri May 1 08:19:29 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23388

            Bug ID: 23388
           Summary: Template compilation failure with
                    -fdelayed-template-parsing when compiling an AST
                    loaded from a PCH/AST file
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: thonermann at coverity.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

The following test demonstrates a compilation failure that occurs only when the
code is first emitted to a .ast file, and then compiled.  Direct compilation
succeeds.  Tested with Clang 3.7.0 trunk (r234313), but this reproduces back to
Clang 3.4.

$ cat t.cpp
int f(int p) {
    return p;
}
template<int N>
struct S {
    static int smf() {
        return f(static_cast<int>(N));
    }
};
auto a = S<0>::smf();

$ clang -c -std=c++11 -fdelayed-template-parsing t.cpp; echo $?
0

$ clang -emit-ast -std=c++11 -fdelayed-template-parsing t.cpp; echo $?
0

$ clang -c t.ast; echo $?
/nfs/thonermann/tmp/t.cpp:7:18: error: use of undeclared identifier
'static_cast'
        return f(static_cast<int>(N));
                 ^
/nfs/thonermann/tmp/t.cpp:7:33: error: expected '(' for function-style cast or
type construction
        return f(static_cast<int>(N));
                             ~~~^
2 errors generated.
1

It seems some state is not being preserved in .ast files.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150501/3d4b42ef/attachment.html>


More information about the llvm-bugs mailing list