<html>
    <head>
      <base href="https://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - clang crashes on invalid C++ code with bad use of member pointer: Assertion `!LHS.get()->getType()->isPlaceholderType() && !RHS.get()->getType()->isPlaceholderType() && "placeholders should have been weeded out by now"' failed"
   href="https://llvm.org/bugs/show_bug.cgi?id=28693">28693</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>clang crashes on invalid C++ code with bad use of member pointer: Assertion `!LHS.get()->getType()->isPlaceholderType() && !RHS.get()->getType()->isPlaceholderType() && "placeholders should have been weeded out by now"' failed
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>C++
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>su@cs.ucdavis.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>dgregor@apple.com, llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>The current clang trunk crashes without any proper diagnostics when compiling
the following C++ test case on x86_64-linux-gnu in both 32-bit and 64-bit
modes. 

3.8.x correctly rejects the code.

This might be related to PR 28030, but PR 28030 crashes with -std=c++11 (not
with -std=c++98). 


$ clang++ -v
clang version 4.0.0 (trunk 276517)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.1.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$
$ clang++ -c small.cpp
clang-4.0:
/tmp/llvm-builder/llvm-source-trunk/tools/clang/lib/Sema/SemaExprCXX.cpp:4790:
clang::QualType clang::Sema::CheckPointerToMemberOperands(clang::ExprResult&,
clang::ExprResult&, clang::ExprValueKind&, clang::SourceLocation, bool):
Assertion `!LHS.get()->getType()->isPlaceholderType() &&
!RHS.get()->getType()->isPlaceholderType() && "placeholders should have been
weeded out by now"' failed.
#0 0x0000000001d6d9b5 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d6d9b5)
#1 0x0000000001d6ba6e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-4.0+0x1d6ba6e)
#2 0x0000000001d6bbd0 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-4.0+0x1d6bbd0)
#3 0x00007facdf4e0340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007facde2d1cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007facde2d50d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007facde2cab86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007facde2cac32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002c5bb0b
clang::Sema::CheckPointerToMemberOperands(clang::ActionResult<clang::Expr*,
true>&, clang::ActionResult<clang::Expr*, true>&, clang::ExprValueKind&,
clang::SourceLocation, bool) (/usr/local/clang-trunk/bin/clang-4.0+0x2c5bb0b)
#9 0x0000000002c0db25 clang::Sema::CreateBuiltinBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2c0db25)
#10 0x0000000002d8d5f7
clang::Sema::CreateOverloadedBinOp(clang::SourceLocation,
clang::BinaryOperatorKind, clang::UnresolvedSetImpl const&, clang::Expr*,
clang::Expr*) (/usr/local/clang-trunk/bin/clang-4.0+0x2d8d5f7)
#11 0x0000000002bd5ec4 BuildOverloadedBinOp(clang::Sema&, clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2bd5ec4)
#12 0x0000000002c0e602 clang::Sema::BuildBinOp(clang::Scope*,
clang::SourceLocation, clang::BinaryOperatorKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2c0e602)
#13 0x0000000002c0eaab clang::Sema::ActOnBinOp(clang::Scope*,
clang::SourceLocation, clang::tok::TokenKind, clang::Expr*, clang::Expr*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2c0eaab)
#14 0x0000000002890171
clang::Parser::ParseRHSOfBinaryExpression(clang::ActionResult<clang::Expr*,
true>, clang::prec::Level) (/usr/local/clang-trunk/bin/clang-4.0+0x2890171)
#15 0x000000000288fcf9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-4.0+0x288fcf9)
#16 0x000000000288fd69
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-4.0+0x288fd69)
#17 0x0000000002894d55
clang::Parser::ParseParenExpression(clang::Parser::ParenParseOption&, bool,
bool, clang::OpaquePtr<clang::QualType>&, clang::SourceLocation&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2894d55)
#18 0x000000000288d75c clang::Parser::ParseCastExpression(bool, bool, bool&,
clang::Parser::TypeCastState) (/usr/local/clang-trunk/bin/clang-4.0+0x288d75c)
#19 0x000000000288fc5d clang::Parser::ParseCastExpression(bool, bool,
clang::Parser::TypeCastState) (/usr/local/clang-trunk/bin/clang-4.0+0x288fc5d)
#20 0x000000000288fce9
clang::Parser::ParseAssignmentExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-4.0+0x288fce9)
#21 0x000000000288fd69
clang::Parser::ParseExpression(clang::Parser::TypeCastState)
(/usr/local/clang-trunk/bin/clang-4.0+0x288fd69)
#22 0x00000000028d0766 clang::Parser::ParseExprStatement()
(/usr/local/clang-trunk/bin/clang-4.0+0x28d0766)
#23 0x00000000028cdc37
clang::Parser::ParseStatementOrDeclarationAfterAttributes(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*,
clang::Parser::ParsedAttributesWithRange&)
(/usr/local/clang-trunk/bin/clang-4.0+0x28cdc37)
#24 0x00000000028cdd8e
clang::Parser::ParseStatementOrDeclaration(llvm::SmallVector<clang::Stmt*,
32u>&, clang::Parser::AllowedContsructsKind, clang::SourceLocation*)
(/usr/local/clang-trunk/bin/clang-4.0+0x28cdd8e)
#25 0x00000000028d2709 clang::Parser::ParseCompoundStatementBody(bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x28d2709)
#26 0x00000000028d4f49 clang::Parser::ParseFunctionStatementBody(clang::Decl*,
clang::Parser::ParseScope&) (/usr/local/clang-trunk/bin/clang-4.0+0x28d4f49)
#27 0x00000000028521db
clang::Parser::ParseFunctionDefinition(clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::Parser::LateParsedAttrList*)
(/usr/local/clang-trunk/bin/clang-4.0+0x28521db)
#28 0x000000000287284d clang::Parser::ParseDeclGroup(clang::ParsingDeclSpec&,
unsigned int, clang::SourceLocation*, clang::Parser::ForRangeInit*)
(/usr/local/clang-trunk/bin/clang-4.0+0x287284d)
#29 0x000000000284de6d
clang::Parser::ParseDeclOrFunctionDefInternal(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec&, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x284de6d)
#30 0x000000000284e511
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier) [clone .part.222]
(/usr/local/clang-trunk/bin/clang-4.0+0x284e511)
#31 0x000000000284e54f
clang::Parser::ParseDeclarationOrFunctionDefinition(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*, clang::AccessSpecifier)
(/usr/local/clang-trunk/bin/clang-4.0+0x284e54f)
#32 0x0000000002853350
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*) (/usr/local/clang-trunk/bin/clang-4.0+0x2853350)
#33 0x0000000002853b20
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/usr/local/clang-trunk/bin/clang-4.0+0x2853b20)
#34 0x000000000284b08b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-4.0+0x284b08b)
#35 0x00000000024e905e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-4.0+0x24e905e)
#36 0x00000000021f861e clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-4.0+0x21f861e)
#37 0x00000000021ce1e6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-4.0+0x21ce1e6)
#38 0x0000000002285192
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-4.0+0x2285192)
#39 0x0000000000b1edc0 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-4.0+0xb1edc0)
#40 0x0000000000acd4b2 main (/usr/local/clang-trunk/bin/clang-4.0+0xacd4b2)
#41 0x00007facde2bcec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#42 0x0000000000b1ada4 _start (/usr/local/clang-trunk/bin/clang-4.0+0xb1ada4)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-4.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free -main-file-name
small.cpp -mrelocation-model static -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debugger-tuning=gdb
-coverage-file /data2/small.cpp -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/4.0.0 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/x86_64-linux-gnu/c++/4.9
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/4.9/../../../../include/c++/4.9/backward
-internal-isystem /usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/4.0.0/include -internal-externc-isystem
/usr/include/x86_64-linux-gnu -internal-externc-isystem /include
-internal-externc-isystem /usr/include -fdeprecated-macro
-fdebug-compilation-dir /data2 -ferror-limit 19 -fmessage-length 142
-fobjc-runtime=gcc -fcxx-exceptions -fexceptions -fdiagnostics-show-option
-fcolor-diagnostics -o small.o -x c++ small.cpp
1.      small.cpp:8:17: current parser token ')'
2.      small.cpp:6:1: parsing function body 'h'
3.      small.cpp:6:1: in compound statement ('{}')
clang-4.0: error: unable to execute command: Aborted (core dumped)
clang-4.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 4.0.0 (trunk 276517)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
clang-4.0: note: diagnostic msg: PLEASE submit a bug report to
<a href="http://llvm.org/bugs/">http://llvm.org/bugs/</a> and include the crash backtrace, preprocessed source, and
associated run script.
clang-4.0: note: diagnostic msg:
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-4.0: note: diagnostic msg: /tmp/small-1f7776.cpp
clang-4.0: note: diagnostic msg: /tmp/small-1f7776.sh
clang-4.0: note: diagnostic msg:

********************
$


-----------------------------------------


struct X {};

template < typename T > T & f ();

void h (int (X::*g) (int))

  // intended: (f < X > ().*g) (0);
  (f < X > ().*f) (0);
}</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>