<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - Testing class template argument deduction"
   href="https://bugs.llvm.org/show_bug.cgi?id=40552">40552</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Testing class template argument deduction
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Linux
          </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++'17
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>chilabot@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>blitzrakete@gmail.com, erik.pilkington@gmail.com, llvm-bugs@lists.llvm.org, richard-llvm@metafoo.co.uk
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21413" name="attach_21413" title="Stack">attachment 21413</a> <a href="attachment.cgi?id=21413&action=edit" title="Stack">[details]</a></span>
Stack

#include <iostream>

template <typename Type>
struct Person
{
    Type &object;

    Person(Type &object) : object(object) {}

    void walk(unsigned steps)
    {
        object.walk(steps);
    }

    void talk(const std::string &words)
    {
        object.talk(words);
    }
};

template <typename Type>
struct CPerson
{
    const Type &object;

    Person(const Type &object) : object(object) {}

    void walk(unsigned steps)
    {
        object.walk(steps);
    }

    void talk(const std::string &words)
    {
        object.talk(words);
    }
};

struct MySelf
{
    void walk(unsigned steps)
    {
        std::cout << "walking: " << steps << std::endl;
    }

    void talk(const std::string &words)
    {
        std::cout << "talking: " << words << std::endl;
    }
};

template <typename Type>
void test(CPerson<Type> object)
{
    object.talk("testing");
    object.walk(50);
}

int main()
{
    MySelf myself;

    test(CPerson{myself});

    return 0;
}



Output: 

[1/3] Compiling ../../src/py.com.personal/other/hanaTest/main.cpp
../../../../src/py.com.personal/other/hanaTest/main.cpp:26:5: error: deduction
guide must be declared in the same scope as template 'Person'
    Person(const Type &object) : object(object) {}
    ^
../../../../src/py.com.personal/other/hanaTest/main.cpp:4:8: note: template is
declared here
struct Person
       ^
../../../../src/py.com.personal/other/hanaTest/main.cpp:26:5: error: deduction
guide declaration without trailing return type
    Person(const Type &object) : object(object) {}
    ^
../../../../src/py.com.personal/other/hanaTest/main.cpp:26:5: error: deduction
guide cannot have a function definition
../../../../src/py.com.personal/other/hanaTest/main.cpp:26:5: error: deduction
guide has different access from the corresponding member template
../../../../src/py.com.personal/other/hanaTest/main.cpp:3:1: note: member
template declared (null) here
template <typename Type>
^
Stack dump:
0.      Program arguments: /home/robert/applib/clang/clang-7.0.0/bin/clang-7
-cc1 -triple x86_64-unknown-linux-gnu -emit-obj -mrelax-all -disable-free
-disable-llvm-verifier -discard-value-names -main-file-name main.cpp
-mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
-fmath-errno -masm-verbose -mconstructor-aliases -munwind-tables
-fuse-init-array -target-cpu x86-64 -dwarf-column-info -debug-info-kind=limited
-dwarf-version=4 -debugger-tuning=gdb -coverage-notes-file
/home/robert/Documents/Private/gitRepos/wt/src/projects/waf/build/debug/src/py.com.personal/other/hanaTest/main.cpp.1.gcno
-resource-dir /home/robert/applib/clang/clang-7.0.0/lib/clang/7.0.0
--system-header-prefix=libxml++ --system-header-prefix=libxml++ -D
BOOST_PP_VARIADICS=1 -D BACKWARD_HAS_DW=1 -D BOOST_PP_VARIADICS=1 -D
BACKWARD_HAS_DW=1 -I src -I ../../../../src -I
../../../../../applib/boost/include/1.69 -I
../../../../../../../../../applib/boost/include/1.69 -D HAVE_LIBXML_2_6=1 -D
HAVE_GTKMM_2_4=1 -D HAVE_GTKMM_3_0=1 -D HAVE_QT5WIDGETS=1 -D HAVE_QT5QUICK=1 -D
HAVE_QT5GUI=1 -D HAVE_QT5QML=1 -D HAVE_SQLITE3=1 -D HAVE_LIBPQ=1 -D
HAVE_LIBXML=1 -internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/x86_64-linux-gnu/c++/5.4.0
-internal-isystem
/usr/lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/backward
-internal-isystem /usr/local/include -internal-isystem
/home/robert/applib/clang/clang-7.0.0/lib/clang/7.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include
-Wreturn-type -Wno-mismatched-tags -Wreturn-type -Wno-mismatched-tags
-Wno-deprecated-register -std=c++17 -fdeprecated-macro -fdebug-compilation-dir
/home/robert/Documents/Private/gitRepos/wt/src/projects/waf/build/debug
-ferror-limit 19 -fmessage-length 0 -fobjc-runtime=gcc -fcxx-exceptions
-fexceptions -fdiagnostics-show-option -o
/home/robert/Documents/Private/gitRepos/wt/src/projects/waf/build/debug/src/py.com.personal/other/hanaTest/main.cpp.1.o
-x c++ ../../../../src/py.com.personal/other/hanaTest/main.cpp -faddrsig 
1.      ../../../../src/py.com.personal/other/hanaTest/main.cpp:26:32: current
parser token ':'
2.      ../../../../src/py.com.personal/other/hanaTest/main.cpp:22:1: parsing
struct/union/class body 'CPerson'
#0 0x0000000001cece54 PrintStackTraceSignalHandler(void*)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x1cece54)
#1 0x0000000001ceae7e llvm::sys::RunSignalHandlers()
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x1ceae7e)
#2 0x0000000001ced012 SignalHandler(int)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x1ced012)
#3 0x00007f7248c5d390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x0000000002f5baac clang::Sema::ActOnCXXMemberDeclarator(clang::Scope*,
clang::AccessSpecifier, clang::Declarator&,
llvm::MutableArrayRef<clang::TemplateParameterList*>, clang::Expr*,
clang::VirtSpecifiers const&, clang::InClassInitStyle)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2f5baac)
#5 0x0000000002b69973
clang::Parser::ParseCXXInlineMethodDef(clang::AccessSpecifier,
clang::ParsedAttributes&, clang::ParsingDeclarator&,
clang::Parser::ParsedTemplateInfo const&, clang::VirtSpecifiers const&,
clang::SourceLocation)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b69973)
#6 0x0000000002b9d8aa
clang::Parser::ParseCXXClassMemberDeclaration(clang::AccessSpecifier,
clang::ParsedAttributes&, clang::Parser::ParsedTemplateInfo const&,
clang::ParsingDeclRAIIObject*)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b9d8aa)
#7 0x0000000002b9dfa8
clang::Parser::ParseCXXClassMemberDeclarationWithPragmas(clang::AccessSpecifier&,
clang::Parser::ParsedAttributesWithRange&, clang::TypeSpecifierType,
clang::Decl*) (/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b9dfa8)
#8 0x0000000002b98865
clang::Parser::ParseCXXMemberSpecification(clang::SourceLocation,
clang::SourceLocation, clang::Parser::ParsedAttributesWithRange&, unsigned int,
clang::Decl*) (/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b98865)
#9 0x0000000002b968e9 clang::Parser::ParseClassSpecifier(clang::tok::TokenKind,
clang::SourceLocation, clang::DeclSpec&, clang::Parser::ParsedTemplateInfo
const&, clang::AccessSpecifier, bool, clang::Parser::DeclSpecContext,
clang::Parser::ParsedAttributesWithRange&)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b968e9)
#10 0x0000000002b78be2
clang::Parser::ParseDeclarationSpecifiers(clang::DeclSpec&,
clang::Parser::ParsedTemplateInfo const&, clang::AccessSpecifier,
clang::Parser::DeclSpecContext, clang::Parser::LateParsedAttrList*)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b78be2)
#11 0x0000000002bf983b
clang::Parser::ParseSingleDeclarationAfterTemplate(clang::DeclaratorContext,
clang::Parser::ParsedTemplateInfo const&, clang::ParsingDeclRAIIObject&,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2bf983b)
#12 0x0000000002bf927e
clang::Parser::ParseTemplateDeclarationOrSpecialization(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2bf927e)
#13 0x0000000002bf8cc0
clang::Parser::ParseDeclarationStartingWithTemplate(clang::DeclaratorContext,
clang::SourceLocation&, clang::ParsedAttributes&, clang::AccessSpecifier)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2bf8cc0)
#14 0x0000000002b782a6
clang::Parser::ParseDeclaration(clang::DeclaratorContext,
clang::SourceLocation&, clang::Parser::ParsedAttributesWithRange&)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b782a6)
#15 0x0000000002b61be7
clang::Parser::ParseExternalDeclaration(clang::Parser::ParsedAttributesWithRange&,
clang::ParsingDeclSpec*)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b61be7)
#16 0x0000000002b6149b
clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b6149b)
#17 0x0000000002b5c9d7 clang::ParseAST(clang::Sema&, bool, bool)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2b5c9d7)
#18 0x00000000022a6717 clang::FrontendAction::Execute()
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x22a6717)
#19 0x0000000002251518
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x2251518)
#20 0x000000000233a7a5
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x233a7a5)
#21 0x0000000000933d7f cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x933d7f)
#22 0x0000000000932343 main
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x932343)
#23 0x00007f7247bf5830 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x20830)
#24 0x000000000092f779 _start
(/home/robert/applib/clang/clang-7.0.0/bin/clang-7+0x92f779)
clang-7: error: unable to execute command: Segmentation fault (core dumped)
clang-7: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 7.0.0 (tags/RELEASE_700/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/robert/applib/clang/clang-7.0.0/bin
clang-7: note: diagnostic msg: PLEASE submit a bug report to
<a href="https://bugs.llvm.org/">https://bugs.llvm.org/</a> and include the crash backtrace, preprocessed source,
and associated run script.
clang-7: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-7: note: diagnostic msg: /tmp/main-4f1c2e.cpp
clang-7: note: diagnostic msg: /tmp/main-4f1c2e.sh
clang-7: note: diagnostic msg:</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>