summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-02-16 22:38:20 +0000
committerDouglas Gregor <dgregor@apple.com>2009-02-16 22:38:20 +0000
commit5978cdb5ef20b10cbc414b364c8122f9eed88d8c (patch)
tree3e4415239a8da14819fd343b210d7ff930ef2980 /clang/lib
parent8ba22471a29de1a5eb6da526a9cf81b64dba4b5e (diff)
downloadbcm5719-llvm-5978cdb5ef20b10cbc414b364c8122f9eed88d8c.tar.gz
bcm5719-llvm-5978cdb5ef20b10cbc414b364c8122f9eed88d8c.zip
Make "implicit int" an error in C++ (unless we're allowing Microsoft
extensions). This caught a couple bugs in our test suite :) llvm-svn: 64686
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaType.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp
index 021e18e5d78..9a575ced9e1 100644
--- a/clang/lib/Sema/SemaType.cpp
+++ b/clang/lib/Sema/SemaType.cpp
@@ -79,14 +79,16 @@ QualType Sema::ConvertDeclSpecToType(const DeclSpec &DS) {
DeclSpec::PQ_TypeSpecifier |
DeclSpec::PQ_TypeQualifier)) == 0)
Diag(DS.getSourceRange().getBegin(), diag::ext_missing_declspec);
- } else {
+ } else if (!DS.hasTypeSpecifier()) {
// C99 and C++ require a type specifier. For example, C99 6.7.2p2 says:
// "At least one type specifier shall be given in the declaration
// specifiers in each declaration, and in the specifier-qualifier list in
// each struct declaration and type name."
- // FIXME: this should be a hard error in C++
- if (!DS.hasTypeSpecifier())
- Diag(DS.getSourceRange().getBegin(), diag::ext_missing_type_specifier);
+ // FIXME: Does Microsoft really have the implicit int extension in C++?
+ unsigned DK = getLangOptions().CPlusPlus && !getLangOptions().Microsoft?
+ diag::err_missing_type_specifier
+ : diag::ext_missing_type_specifier;
+ Diag(DS.getSourceRange().getBegin(), DK);
}
// FALL THROUGH.
OpenPOWER on IntegriCloud