LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 12705 - In microsoft mode, delay default template argument checking until template definition time
Summary: In microsoft mode, delay default template argument checking until template de...
Status: RESOLVED FIXED
Alias: None
Product: clang
Classification: Unclassified
Component: C++ (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P enhancement
Assignee: Unassigned Clang Bugs
URL:
Keywords:
: 16180 (view as bug list)
Depends on:
Blocks: 13707
  Show dependency tree
 
Reported: 2012-04-30 12:28 PDT by Nico Weber
Modified: 2014-08-11 11:48 PDT (History)
8 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2012-04-30 12:28:28 PDT
template<class T, class S = Foo>
class Class;

class Foo {};


template<class T, class S>
class Class {
};



C:\src\chrome\src>cl test.cc /c
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation.  All rights reserved.

test.cc

C:\src\chrome\src>..\..\llvm-build\bin\Release\clang.exe -c test.cc
test.cc:1:29: error: unknown type name 'Foo'
template<class T, class S = Foo>
                            ^
1 error generated.


This is required to parse atlwin.h
Comment 1 Nico Weber 2012-06-24 21:18:20 PDT
cl also accepts:


template<class T, class S = Foo>
class Class;

template<class T, class S>
class Class {
};

class Foo {};

void f() {
  Class<int> c;
}



It doesn't accept:


template<class T, class S = Foo>
class Class;

template<class T, class S>
class Class {
};

void f() {
  Class<int> c;
}

class Foo {};
Comment 2 Hans Wennborg 2013-06-03 11:11:34 PDT
*** Bug 16180 has been marked as a duplicate of this bug. ***
Comment 3 Reid Kleckner 2014-08-11 11:48:34 PDT
This was fixed in r210382, we accept with a warning:

$ clang -c t.cpp
t.cpp:1:29: warning: using the undeclared type 'Foo' as a default template argument is a Microsoft extension [-Wmicrosoft]
template<class T, class S = Foo>
                            ^
1 warning generated.