[llvm-bugs] [Bug 37830] New: ICE with typeof applied to template parameter dependent expression

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jun 18 01:21:43 PDT 2018


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

            Bug ID: 37830
           Summary: ICE with typeof applied to template parameter
                    dependent expression
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: zhonghao at pku.org.cn
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

The code is as follow:

# 1 "foo.cc"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.cc"

template<typename T>
void Bar(T t, typeof(T() - T()) s) {}

int main() {
        char* a;
        int i;
        Bar(a, i);
        return 0;
}

clang++ produces no error message, when it compiles the above code. gcc++
produces an error message. In particular, it warns that "void Bar(T t,
typeof(T() - T()) s) {}" shall be changed to "void Bar(T t, decltype(T() - T())
s) {}". 

Shall clang++ present similar error messages?

-- 
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/20180618/18d38e42/attachment.html>


More information about the llvm-bugs mailing list